1 |
693 |
jeremybenn |
// { dg-do compile }
|
2 |
|
|
// Origin: Wolfgang Bangerth
|
3 |
|
|
// and Rene Fonseca
|
4 |
|
|
// PR c++/8271: Check cv-qualifiers while unifying pointer to member
|
5 |
|
|
// functions.
|
6 |
|
|
|
7 |
|
|
struct MyClass {
|
8 |
|
|
void mMethod() throw() {}
|
9 |
|
|
void cMethod() const throw() {}
|
10 |
|
|
void vMethod() volatile throw() {}
|
11 |
|
|
void cvMethod() const volatile throw() {}
|
12 |
|
|
};
|
13 |
|
|
|
14 |
|
|
template
|
15 |
|
|
void mFunction(void (CLASS::* method)()) {} // { dg-message "note" }
|
16 |
|
|
|
17 |
|
|
template
|
18 |
|
|
void cFunction(void (CLASS::* method)() const) {} // { dg-message "note" }
|
19 |
|
|
|
20 |
|
|
template
|
21 |
|
|
void vFunction(void (CLASS::* method)() volatile) {} // { dg-message "note" }
|
22 |
|
|
|
23 |
|
|
template
|
24 |
|
|
void cvFunction(void (CLASS::* method)() const volatile) {} // { dg-message "note" }
|
25 |
|
|
|
26 |
|
|
int main() {
|
27 |
|
|
mFunction(&MyClass::mMethod);
|
28 |
|
|
mFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
29 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 28 }
|
30 |
|
|
mFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
31 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 30 }
|
32 |
|
|
mFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
33 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 32 }
|
34 |
|
|
|
35 |
|
|
cFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
36 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 35 }
|
37 |
|
|
cFunction(&MyClass::cMethod);
|
38 |
|
|
cFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
39 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 38 }
|
40 |
|
|
cFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
41 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 40 }
|
42 |
|
|
|
43 |
|
|
vFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
44 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 43 }
|
45 |
|
|
vFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
46 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 45 }
|
47 |
|
|
vFunction(&MyClass::vMethod);
|
48 |
|
|
vFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
|
49 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 48 }
|
50 |
|
|
|
51 |
|
|
cvFunction(&MyClass::mMethod); // { dg-error "no matching function" }
|
52 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 51 }
|
53 |
|
|
cvFunction(&MyClass::cMethod); // { dg-error "no matching function" }
|
54 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 53 }
|
55 |
|
|
cvFunction(&MyClass::vMethod); // { dg-error "no matching function" }
|
56 |
|
|
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 55 }
|
57 |
|
|
cvFunction(&MyClass::cvMethod);
|
58 |
|
|
|
59 |
|
|
return 0;
|
60 |
|
|
}
|