1*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc void h(); 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc template<typename T> void f() noexcept(sizeof(T) == 4) { h(); } 6*f4a2713aSLionel Sambuc template<typename T> void g() noexcept(sizeof(T) == 4); 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc template<typename T> struct S { 9*f4a2713aSLionel Sambuc static void f() noexcept(sizeof(T) == 4) { h(); } 10*f4a2713aSLionel Sambuc static void g() noexcept(sizeof(T) == 4); 11*f4a2713aSLionel Sambuc }; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIsEvv() [[NONE:#[0-9]+]] { 14*f4a2713aSLionel Sambuc template<> void f<short>() { h(); } 15*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIA2_sEvv() [[NUW:#[0-9]+]] { 16*f4a2713aSLionel Sambuc template<> void f<short[2]>() noexcept { h(); } 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIsE1fEv() 19*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 20*f4a2713aSLionel Sambuc template<> void S<short>::f() { h(); } 21*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIA2_sE1fEv() [[NUW]] 22*f4a2713aSLionel Sambuc template<> void S<short[2]>::f() noexcept { h(); } 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIDsEvv() [[NONE]] { 25*f4a2713aSLionel Sambuc template void f<char16_t>(); 26*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] { 27*f4a2713aSLionel Sambuc template void f<char16_t[2]>(); 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIDsE1fEv() 30*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 31*f4a2713aSLionel Sambuc template void S<char16_t>::f(); 32*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() [[NUW]] 33*f4a2713aSLionel Sambuc template void S<char16_t[2]>::f(); 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc void h() { 36*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] { 37*f4a2713aSLionel Sambuc f<int>(); 38*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIA2_iEvv() [[NONE]] { 39*f4a2713aSLionel Sambuc f<int[2]>(); 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIiE1fEv() [[NUW]] 42*f4a2713aSLionel Sambuc S<int>::f(); 43*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIA2_iE1fEv() 44*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 45*f4a2713aSLionel Sambuc S<int[2]>::f(); 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] { 48*f4a2713aSLionel Sambuc void (*f1)() = &f<float>; 49*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIdEvv() [[NONE]] { 50*f4a2713aSLionel Sambuc void (*f2)() = &f<double>; 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIfE1fEv() [[NUW]] 53*f4a2713aSLionel Sambuc void (*f3)() = &S<float>::f; 54*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIdE1fEv() 55*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 56*f4a2713aSLionel Sambuc void (*f4)() = &S<double>::f; 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] { 59*f4a2713aSLionel Sambuc (void)&f<char[4]>; 60*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1fIcEvv() [[NONE]] { 61*f4a2713aSLionel Sambuc (void)&f<char>; 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIA4_cE1fEv() [[NUW]] 64*f4a2713aSLionel Sambuc (void)&S<char[4]>::f; 65*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_ZN1SIcE1fEv() 66*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 67*f4a2713aSLionel Sambuc (void)&S<char>::f; 68*f4a2713aSLionel Sambuc } 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1iv 71*f4a2713aSLionel Sambuc void i() { 72*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIiEvv() [[NUW]] 73*f4a2713aSLionel Sambuc g<int>(); 74*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIA2_iEvv() 75*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 76*f4a2713aSLionel Sambuc g<int[2]>(); 77*f4a2713aSLionel Sambuc 78*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIiE1gEv() [[NUW]] 79*f4a2713aSLionel Sambuc S<int>::g(); 80*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIA2_iE1gEv() 81*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 82*f4a2713aSLionel Sambuc S<int[2]>::g(); 83*f4a2713aSLionel Sambuc 84*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIfEvv() [[NUW]] 85*f4a2713aSLionel Sambuc void (*g1)() = &g<float>; 86*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIdEvv() 87*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 88*f4a2713aSLionel Sambuc void (*g2)() = &g<double>; 89*f4a2713aSLionel Sambuc 90*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIfE1gEv() [[NUW]] 91*f4a2713aSLionel Sambuc void (*g3)() = &S<float>::g; 92*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIdE1gEv() 93*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 94*f4a2713aSLionel Sambuc void (*g4)() = &S<double>::g; 95*f4a2713aSLionel Sambuc 96*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIA4_cEvv() [[NUW]] 97*f4a2713aSLionel Sambuc (void)&g<char[4]>; 98*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_Z1gIcEvv() 99*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 100*f4a2713aSLionel Sambuc (void)&g<char>; 101*f4a2713aSLionel Sambuc 102*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIA4_cE1gEv() [[NUW]] 103*f4a2713aSLionel Sambuc (void)&S<char[4]>::g; 104*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN1SIcE1gEv() 105*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 106*f4a2713aSLionel Sambuc (void)&S<char>::g; 107*f4a2713aSLionel Sambuc } 108*f4a2713aSLionel Sambuc 109*f4a2713aSLionel Sambuc template<typename T> struct Nested { 110*f4a2713aSLionel Sambuc template<bool b, typename U> void f() noexcept(sizeof(T) == sizeof(U)); 111*f4a2713aSLionel Sambuc }; 112*f4a2713aSLionel Sambuc 113*f4a2713aSLionel Sambuc // CHECK: define {{.*}} @_Z1jv 114*f4a2713aSLionel Sambuc void j() { 115*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN6NestedIiE1fILb1EcEEvv( 116*f4a2713aSLionel Sambuc // CHECK-NOT: [[NUW]] 117*f4a2713aSLionel Sambuc Nested<int>().f<true, char>(); 118*f4a2713aSLionel Sambuc // CHECK: declare {{.*}} @_ZN6NestedIlE1fILb0ElEEvv({{.*}}) [[NUW]] 119*f4a2713aSLionel Sambuc Nested<long>().f<false, long>(); 120*f4a2713aSLionel Sambuc } 121*f4a2713aSLionel Sambuc 122*f4a2713aSLionel Sambuc // CHECK: attributes [[NONE]] = { {{.*}} } 123*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} } 124