xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/cxx1y-variable-template.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++1y -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // Check that we keep the 'extern' when we instantiate the definition of this
4f4a2713aSLionel Sambuc // variable template specialization.
5f4a2713aSLionel Sambuc template<typename T> extern const int extern_redecl;
6f4a2713aSLionel Sambuc template<typename T> const int extern_redecl = 5;
7f4a2713aSLionel Sambuc template const int extern_redecl<int>;
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc // CHECK: @_Z13extern_redeclIiE = weak_odr constant
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc template<typename T> struct Outer {
12f4a2713aSLionel Sambuc   template<typename U> struct Inner {
13f4a2713aSLionel Sambuc     template<typename V> static int arr[];
14f4a2713aSLionel Sambuc   };
15f4a2713aSLionel Sambuc };
16f4a2713aSLionel Sambuc Outer<char[100]> outer_int;
17f4a2713aSLionel Sambuc int init_arr();
18f4a2713aSLionel Sambuc template<typename T> template<typename U> template<typename V> int Outer<T>::Inner<U>::arr[sizeof(T) + sizeof(U) + sizeof(V)] = { init_arr() };
19f4a2713aSLionel Sambuc int *p = Outer<char[100]>::Inner<char[20]>::arr<char[3]>;
20f4a2713aSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc // CHECK: @_ZN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = linkonce_odr global [123 x i32] zeroinitializer
22*0a6a1f1dSLionel Sambuc // CHECK: @_ZGVN5OuterIA100_cE5InnerIA20_cE3arrIA3_cEE = linkonce_odr global
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc // CHECK: call {{.*}}@_Z8init_arrv
25