aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/linkage1.C
blob: 02aa96729636df49849d3f7a6bc94f4218fcedb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/50372
// Test that a template instantiation has the same linkage as its argument.
// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z3fooIXadL_Z13external_funcvEEEvv" } }
// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z3fooIXadL_ZL11static_funcvEEEvv" } }

template<void (*fptr)(void)>
void foo() { }

static void static_func() {}
void external_func() { }

void test()
{
#if __cplusplus > 199711L
  foo<&static_func>();
#endif
  foo<&external_func>();
}