| 1 |
// { dg-do run } |
| 2 |
// 980945 bkoz |
| 3 |
// test for correct operators at link time |
| 4 |
|
| 5 |
/* |
| 6 |
/tmp/cca211431.o: In function `void blah<foo<int> >(foo<int> const &)': |
| 7 |
/tmp/cca211431.o(.void gnu.linkonce.t.blah<foo<int> >(foo<int> const &)+0x1e): undefined reference to `void x<int>(int const &)' |
| 8 |
*/ |
| 9 |
|
| 10 |
template<class T> |
| 11 |
class foo { |
| 12 |
public: |
| 13 |
foo () {} |
| 14 |
friend void x (const T &) { } |
| 15 |
}; |
| 16 |
|
| 17 |
void x(const int &); |
| 18 |
|
| 19 |
template<class T> |
| 20 |
void blah (const T &) { |
| 21 |
T y; |
| 22 |
x (4); |
| 23 |
} |
| 24 |
|
| 25 |
int main () { |
| 26 |
const foo<int> v; |
| 27 |
blah (v); |
| 28 |
} |
| 29 |
|
| 30 |
/* |
| 31 |
fno-exceptions -fno-rtti |
| 32 |
|
| 33 |
1.98r1.o: |
| 34 |
00000000 W __t3foo1Zi |
| 35 |
00000000 W blah__H1Zt3foo1Zi_RCX01_v |
| 36 |
00000000 t gcc2_compiled. |
| 37 |
00000000 T main |
| 38 |
U x__H1Zi_RCX01_v |
| 39 |
|
| 40 |
1.egcs.o: |
| 41 |
00000000 W __t3foo1Zi |
| 42 |
00000000 W blah__H1Zt3foo1Zi_RCX01_v |
| 43 |
00000000 t gcc2_compiled. |
| 44 |
00000000 T main |
| 45 |
00000000 W x__FRCi |
| 46 |
|
| 47 |
|
| 48 |
the reason this goes away at -O is because the U or W function is |
| 49 |
elided completely. |
| 50 |
|
| 51 |
*/ |
| 52 |
|