1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns %s -o - | FileCheck %s -check-prefix=CHECKA -check-prefix=CHECK
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns -fcxx-exceptions %s -o - | FileCheck %s -check-prefix=CHECKB -check-prefix=CHECK
3 // expected-no-diagnostics
5 // The variable template specialization x<Foo> generated in each file
6 // should be 'internal global' and not 'linkonce_odr global'.
8 template <typename T> int x = 42;
10 // CHECK-DAG: @_Z1xIZL3foovE3FooE = internal global
12 // CHECK-DAG: define internal dereferenceable(4) i32* @_ZL3foov(
16 // CHECK-DAG: ret i32* @_Z1xIZL3foovE3FooE
21 #if !__has_feature(cxx_exceptions) // File A
22 // CHECKA-DAG: define dereferenceable(4) i32* @_Z3barv(
24 // CHECKA-DAG: call dereferenceable(4) i32* @_ZL3foov()
30 // CHECKB-DAG: declare dereferenceable(4) i32* @_Z3barv(
34 // CHECKB-DAG: call dereferenceable(4) i32* @_Z3barv()
35 // CHECKB-DAG: call dereferenceable(4) i32* @_ZL3foov()
36 &bar() == &foo() ? throw 0 : (void)0; // Should not throw exception at runtime.
39 #endif // end of Files A and B