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