| 1 |
// PR c++/24511 - [DR 470] explicit instantiation/extern template unsats |
| 2 |
// on symbols defined later |
| 3 |
// { dg-do compile } |
| 4 |
|
| 5 |
template <class T> struct S { T foo (); T bar (); }; |
| 6 |
template <class T> T S<T>::foo () { return T (); } |
| 7 |
|
| 8 |
#ifndef MAIN |
| 9 |
|
| 10 |
// This part is being tested by the dg-final directive. |
| 11 |
template struct S<int>; |
| 12 |
#else |
| 13 |
|
| 14 |
// This part is not being tested. |
| 15 |
extern template struct S<int>; |
| 16 |
int main () |
| 17 |
{ |
| 18 |
return S<int>().foo () + S<int>().bar (); |
| 19 |
} |
| 20 |
#endif |
| 21 |
|
| 22 |
template <class T> T S<T>::bar () { return T (); } |
| 23 |
|
| 24 |
// { dg-final { scan-assembler-not "\\\*UND\\\*\[^\n]*_Z1fIiEvPT_" } } |