annotate gcc/testsuite/g++.dg/template/unify10.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile }
kono
parents:
diff changeset
2 // Origin: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
kono
parents:
diff changeset
3 // and Rene Fonseca <fonseca at mip dot sdu dot dk>
kono
parents:
diff changeset
4 // PR c++/8271: Check cv-qualifiers while unifying pointer to member
kono
parents:
diff changeset
5 // functions.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 struct MyClass {
kono
parents:
diff changeset
8 void mMethod() throw() {}
kono
parents:
diff changeset
9 void cMethod() const throw() {}
kono
parents:
diff changeset
10 void vMethod() volatile throw() {}
kono
parents:
diff changeset
11 void cvMethod() const volatile throw() {}
kono
parents:
diff changeset
12 };
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 template<class CLASS>
kono
parents:
diff changeset
15 void mFunction(void (CLASS::* method)()) {} // { dg-message "note" }
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 template<class CLASS>
kono
parents:
diff changeset
18 void cFunction(void (CLASS::* method)() const) {} // { dg-message "note" }
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 template<class CLASS>
kono
parents:
diff changeset
21 void vFunction(void (CLASS::* method)() volatile) {} // { dg-message "note" }
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 template<class CLASS>
kono
parents:
diff changeset
24 void cvFunction(void (CLASS::* method)() const volatile) {} // { dg-message "note" }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 int main() {
kono
parents:
diff changeset
27 mFunction(&MyClass::mMethod);
kono
parents:
diff changeset
28 mFunction(&MyClass::cMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
29 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
30 mFunction(&MyClass::vMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
31 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
32 mFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
33 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 cFunction(&MyClass::mMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
36 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
37 cFunction(&MyClass::cMethod);
kono
parents:
diff changeset
38 cFunction(&MyClass::vMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
39 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
40 cFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
41 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 vFunction(&MyClass::mMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
44 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
45 vFunction(&MyClass::cMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
46 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
47 vFunction(&MyClass::vMethod);
kono
parents:
diff changeset
48 vFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
49 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 cvFunction(&MyClass::mMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
52 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
53 cvFunction(&MyClass::cMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
54 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
55 cvFunction(&MyClass::vMethod); // { dg-error "no matching function" }
kono
parents:
diff changeset
56 // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } .-1 }
kono
parents:
diff changeset
57 cvFunction(&MyClass::cvMethod);
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 return 0;
kono
parents:
diff changeset
60 }