1 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s
2 // expected-no-diagnostics
6 template<typename T
> void f() noexcept(sizeof(T
) == 4) { h(); }
7 template<typename T
> void g() noexcept(sizeof(T
) == 4);
9 template<typename T
> struct S
{
10 static void f() noexcept(sizeof(T
) == 4) { h(); }
11 static void g() noexcept(sizeof(T
) == 4);
14 // CHECK: define {{.*}} @_Z1fIsEvv() [[NONE:#[0-9]+]] {
15 template<> void f
<short>() { h(); }
16 // CHECK: define {{.*}} @_Z1fIA2_sEvv() [[NUW:#[0-9]+]] personality ptr @__gxx_personality_v0 {
17 template<> void f
<short[2]>() noexcept
{ h(); }
19 // CHECK: define {{.*}} @_ZN1SIsE1fEv()
21 template<> void S
<short>::f() { h(); }
22 // CHECK: define {{.*}} @_ZN1SIA2_sE1fEv() [[NUW]]
23 template<> void S
<short[2]>::f() noexcept
{ h(); }
25 // CHECK: define {{.*}} @_Z1fIDsEvv() [[NONE]] comdat {
26 template void f
<char16_t
>();
27 // CHECK: define {{.*}} @_Z1fIA2_DsEvv() [[NUW]] comdat personality ptr @__gxx_personality_v0 {
28 template void f
<char16_t
[2]>();
30 // CHECK: define {{.*}} @_ZN1SIDsE1fEv()
32 template void S
<char16_t
>::f();
33 // CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() [[NUW]]
34 template void S
<char16_t
[2]>::f();
37 // CHECK: define {{.*}} @_Z1fIiEvv() [[NUW]] comdat personality ptr @__gxx_personality_v0 {
39 // CHECK: define {{.*}} @_Z1fIA2_iEvv() [[NONE]] comdat {
42 // CHECK: define {{.*}} @_ZN1SIiE1fEv() [[NUW]]
44 // CHECK: define {{.*}} @_ZN1SIA2_iE1fEv()
48 // CHECK: define {{.*}} @_Z1fIfEvv() [[NUW]] comdat personality ptr @__gxx_personality_v0 {
49 void (*f1
)() = &f
<float>;
50 // CHECK: define {{.*}} @_Z1fIdEvv() [[NONE]] comdat {
51 void (*f2
)() = &f
<double>;
53 // CHECK: define {{.*}} @_ZN1SIfE1fEv() [[NUW]]
54 void (*f3
)() = &S
<float>::f
;
55 // CHECK: define {{.*}} @_ZN1SIdE1fEv()
57 void (*f4
)() = &S
<double>::f
;
59 // CHECK: define {{.*}} @_Z1fIA4_cEvv() [[NUW]] comdat personality ptr @__gxx_personality_v0 {
61 // CHECK: define {{.*}} @_Z1fIcEvv() [[NONE]] comdat {
64 // CHECK: define {{.*}} @_ZN1SIA4_cE1fEv() [[NUW]]
66 // CHECK: define {{.*}} @_ZN1SIcE1fEv()
71 // CHECK: define {{.*}} @_Z1iv
73 // CHECK: declare {{.*}} @_Z1gIiEvv() [[NUW2:#[0-9]+]]
75 // CHECK: declare {{.*}} @_Z1gIA2_iEvv()
79 // CHECK: declare {{.*}} @_ZN1SIiE1gEv() [[NUW2]]
81 // CHECK: declare {{.*}} @_ZN1SIA2_iE1gEv()
85 // CHECK: declare {{.*}} @_Z1gIfEvv() [[NUW2]]
86 void (*g1
)() = &g
<float>;
87 // CHECK: declare {{.*}} @_Z1gIdEvv()
89 void (*g2
)() = &g
<double>;
91 // CHECK: declare {{.*}} @_ZN1SIfE1gEv() [[NUW2]]
92 void (*g3
)() = &S
<float>::g
;
93 // CHECK: declare {{.*}} @_ZN1SIdE1gEv()
95 void (*g4
)() = &S
<double>::g
;
97 // CHECK: declare {{.*}} @_Z1gIA4_cEvv() [[NUW2]]
99 // CHECK: declare {{.*}} @_Z1gIcEvv()
100 // CHECK-NOT: [[NUW]]
103 // CHECK: declare {{.*}} @_ZN1SIA4_cE1gEv() [[NUW2]]
104 (void)&S
<char[4]>::g
;
105 // CHECK: declare {{.*}} @_ZN1SIcE1gEv()
106 // CHECK-NOT: [[NUW]]
110 template<typename T
> struct Nested
{
111 template<bool b
, typename U
> void f() noexcept(sizeof(T
) == sizeof(U
));
114 // CHECK: define {{.*}} @_Z1jv
116 // CHECK: declare {{.*}} @_ZN6NestedIiE1fILb1EcEEvv(
117 // CHECK-NOT: [[NUW]]
118 Nested
<int>().f
<true, char>();
119 // CHECK: declare {{.*}} @_ZN6NestedIlE1fILb0ElEEvv({{.*}}) [[NUW2]]
120 Nested
<long>().f
<false, long>();
123 // CHECK: attributes [[NONE]] = { {{.*}} }
124 // CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }
125 // CHECK: attributes [[NUW2]] = { nounwind{{.*}} }
130 template <class T
> struct DWFIterator
{ virtual void get() throw(int) = 0; };
131 void foo(DWFIterator
<int> *foo
) { foo
->get(); }