| 1 |
// PR c++/50372 |
| 2 |
// Test that a template instantiation has the same linkage as its argument. |
| 3 |
// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z3fooIXadL_Z13external_funcvEEEvv" } } |
| 4 |
// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z3fooIXadL_ZL11static_funcvEEEvv" { xfail powerpc-*-aix* } } } |
| 5 |
|
| 6 |
template<void (*fptr)(void)> |
| 7 |
void foo() { } |
| 8 |
|
| 9 |
static void static_func() {} |
| 10 |
void external_func() { } |
| 11 |
|
| 12 |
void test() |
| 13 |
{ |
| 14 |
#if __cplusplus > 199711L |
| 15 |
foo<&static_func>(); |
| 16 |
#endif |
| 17 |
foo<&external_func>(); |
| 18 |
} |