1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
5 static const int index
;
10 const int HasStaticInit
<T
>::index
= the_count
++;
12 template <typename T
> int func_tmpl1() { return HasStaticInit
<T
>::index
; }
13 template <typename T
> int func_tmpl2() { return HasStaticInit
<T
>::index
; }
14 template <typename T
> int func_tmpl3() { return HasStaticInit
<T
>::index
; }
21 // Throw in a final explicit instantiation to see that it doesn't screw things
23 template struct HasStaticInit
<int>;
25 // There should only be one entry, not 3.
26 // CHECK: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }]
28 // There should only be one update to @the_count.
29 // CHECK-NOT: store i32 %{{.*}}, ptr @the_count
30 // CHECK: store i32 %{{.*}}, ptr @the_count
31 // CHECK-NOT: store i32 %{{.*}}, ptr @the_count