1 |
693 |
jeremybenn |
// { dg-do compile }
|
2 |
|
|
|
3 |
|
|
// Copyright 2005 Free Software Foundation
|
4 |
|
|
// contributed by Alexandre Oliva
|
5 |
|
|
// inspired in the failure reported in Red Hat bugzilla #168260.
|
6 |
|
|
|
7 |
|
|
template void bind(F f) {} // { dg-message "note" }
|
8 |
|
|
|
9 |
|
|
template void bindm(F f) {} // { dg-message "note" }
|
10 |
|
|
template void bindm(F (T::*f)(void)) {} // { dg-message "note" }
|
11 |
|
|
|
12 |
|
|
template void bindn(F f) {}
|
13 |
|
|
template void bindn(F (*f)(T)) {}
|
14 |
|
|
|
15 |
|
|
template void bindb(F f) {}
|
16 |
|
|
template void bindb(F (*f)(T)) {} // { dg-message "note" }
|
17 |
|
|
template void bindb(F (T::*f)(void)) {} // { dg-message "note" }
|
18 |
|
|
|
19 |
|
|
struct foo {
|
20 |
|
|
static int baist;
|
21 |
|
|
int bait; // { dg-error "non-static data member" }
|
22 |
|
|
void barf ();
|
23 |
|
|
static void barf (int);
|
24 |
|
|
|
25 |
|
|
struct bar {
|
26 |
|
|
static int baikst;
|
27 |
|
|
int baikt;
|
28 |
|
|
void bark ();
|
29 |
|
|
static void bark (int);
|
30 |
|
|
|
31 |
|
|
bar() {
|
32 |
|
|
bind (&baist);
|
33 |
|
|
bind (&foo::baist);
|
34 |
|
|
bind (&bait); // { dg-error "from this location" }
|
35 |
|
|
bind (&foo::bait);
|
36 |
|
|
|
37 |
|
|
bind (&baikst);
|
38 |
|
|
bind (&bar::baikst);
|
39 |
|
|
bind (&baikt); // ok, this->baikt
|
40 |
|
|
bind (&bar::baikt);
|
41 |
|
|
|
42 |
|
|
bind (&barf); // { dg-error "no matching function" }
|
43 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 42 }
|
44 |
|
|
bind (&foo::barf); // { dg-error "no matching function" }
|
45 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 44 }
|
46 |
|
|
|
47 |
|
|
bindm (&barf); // { dg-error "no matching function" }
|
48 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 47 }
|
49 |
|
|
bindm (&foo::barf);
|
50 |
|
|
|
51 |
|
|
bindn (&barf);
|
52 |
|
|
bindn (&foo::barf);
|
53 |
|
|
|
54 |
|
|
bindb (&barf);
|
55 |
|
|
bindb (&foo::barf); // { dg-error "ambiguous" }
|
56 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 55 }
|
57 |
|
|
|
58 |
|
|
bind (&bark); // { dg-error "no matching function" }
|
59 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 58 }
|
60 |
|
|
bind (&bar::bark); // { dg-error "no matching function" }
|
61 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 60 }
|
62 |
|
|
|
63 |
|
|
bindm (&bark); // { dg-error "no matching function" }
|
64 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 63 }
|
65 |
|
|
bindm (&bar::bark);
|
66 |
|
|
|
67 |
|
|
bindn (&bark);
|
68 |
|
|
bindn (&bar::bark);
|
69 |
|
|
|
70 |
|
|
bindb (&bark);
|
71 |
|
|
bindb (&bar::bark); // { dg-error "ambiguous" }
|
72 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 71 }
|
73 |
|
|
}
|
74 |
|
|
};
|
75 |
|
|
|
76 |
|
|
template
|
77 |
|
|
struct barT {
|
78 |
|
|
static int baikst;
|
79 |
|
|
int baikt;
|
80 |
|
|
void bark ();
|
81 |
|
|
static void bark (int);
|
82 |
|
|
|
83 |
|
|
barT() {
|
84 |
|
|
bind (&baist);
|
85 |
|
|
bind (&foo::baist);
|
86 |
|
|
bind (&bait); // { dg-error "from this location" }
|
87 |
|
|
bind (&foo::bait);
|
88 |
|
|
|
89 |
|
|
bind (&baikst);
|
90 |
|
|
bind (&barT::baikst);
|
91 |
|
|
bind (&baikt); // ok, this->baikt
|
92 |
|
|
bind (&barT::baikt);
|
93 |
|
|
|
94 |
|
|
bind (&barf); // { dg-error "no matching function" }
|
95 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 94 }
|
96 |
|
|
bind (&foo::barf); // { dg-error "no matching function" }
|
97 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 96 }
|
98 |
|
|
|
99 |
|
|
bindm (&barf); // { dg-error "no matching function" }
|
100 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 99 }
|
101 |
|
|
bindm (&foo::barf);
|
102 |
|
|
|
103 |
|
|
bindn (&barf);
|
104 |
|
|
bindn (&foo::barf);
|
105 |
|
|
|
106 |
|
|
bindb (&barf);
|
107 |
|
|
bindb (&foo::barf); // { dg-error "ambiguous" }
|
108 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 107 }
|
109 |
|
|
|
110 |
|
|
bind (&bark); // { dg-error "no matching function" }
|
111 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 110 }
|
112 |
|
|
bind (&barT::bark); // { dg-error "no matching function" }
|
113 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 112 }
|
114 |
|
|
|
115 |
|
|
bindm (&bark); // { dg-error "no matching function" }
|
116 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 115 }
|
117 |
|
|
bindm (&barT::bark);
|
118 |
|
|
|
119 |
|
|
bindn (&bark);
|
120 |
|
|
bindn (&barT::bark);
|
121 |
|
|
|
122 |
|
|
bindb (&bark);
|
123 |
|
|
bindb (&barT::bark); // { dg-error "ambiguous" }
|
124 |
|
|
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 123 }
|
125 |
|
|
}
|
126 |
|
|
};
|
127 |
|
|
|
128 |
|
|
bar bard;
|
129 |
|
|
barT bart;
|
130 |
|
|
} bad;
|