31 lines · cpp
1// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s2 3// CHECK: @llvm.global_ctors4// CHECK-SAME: i32 65535, ptr @_ZN3Foo3fooEv5// CHECK-SAME: i32 101, ptr @_Z22template_dependent_cxxILi101EEvv6// CHECK-SAME: i32 102, ptr @_Z22template_dependent_gnuILi102EEvv7// CHECK-SAME: i32 103, ptr @_Z1fv8// CHECK-SAME: i32 104, ptr @_Z23template_dependent_nttpIiLi104EEvv9 10// PR652111void bar();12struct Foo {13 // CHECK-LABEL: define linkonce_odr {{.*}}void @_ZN3Foo3fooEv14 static void foo() __attribute__((constructor)) {15 bar();16 }17};18 19 20template <int P>21[[gnu::constructor(P)]] void template_dependent_cxx() {}22template <int P>23__attribute__((constructor(P))) void template_dependent_gnu() {}24template <typename T, int P = sizeof(T) * 26>25[[gnu::constructor(P)]] void template_dependent_nttp() {}26 27template void template_dependent_cxx<101>();28template void template_dependent_gnu<102>();29[[gnu::constructor(103)]] void f() {}30template void template_dependent_nttp<int>();31