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