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