summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGenCXX/cxx11-exception-spec.cpp64
-rw-r--r--test/SemaTemplate/instantiate-exception-spec-cxx11.cpp13
2 files changed, 69 insertions, 8 deletions
diff --git a/test/CodeGenCXX/cxx11-exception-spec.cpp b/test/CodeGenCXX/cxx11-exception-spec.cpp
index 461af78eae..4e08dce2ae 100644
--- a/test/CodeGenCXX/cxx11-exception-spec.cpp
+++ b/test/CodeGenCXX/cxx11-exception-spec.cpp
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -std=c++11 -verify -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s
-template<typename T> void f() noexcept(sizeof(T) == 4);
+void h();
+
+template<typename T> void f() noexcept(sizeof(T) == 4) { h(); }
+
+template<typename T> struct S {
+ static void f() noexcept(sizeof(T) == 4) { h(); }
+};
+
+// CHECK: define {{.*}} @_Z1fIsEvv() {
+template<> void f<short>() { h(); }
+// CHECK: define {{.*}} @_Z1fIA2_sEvv() nounwind {
+template<> void f<short[2]>() noexcept { h(); }
+
+// CHECK: define {{.*}} @_ZN1SIsE1fEv()
+// CHECK-NOT: nounwind
+template<> void S<short>::f() { h(); }
+// CHECK: define {{.*}} @_ZN1SIA2_sE1fEv() nounwind
+template<> void S<short[2]>::f() noexcept { h(); }
+
+// CHECK: define {{.*}} @_Z1fIDsEvv() {
+template void f<char16_t>();
+// CHECK: define {{.*}} @_Z1fIA2_DsEvv() nounwind {
+template void f<char16_t[2]>();
+
+// CHECK: define {{.*}} @_ZN1SIDsE1fEv()
+// CHECK-NOT: nounwind
+template void S<char16_t>::f();
+// CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() nounwind
+template void S<char16_t[2]>::f();
void g() {
- // CHECK: declare void @_Z1fIiEvv() nounwind
+ // CHECK: define {{.*}} @_Z1fIiEvv() nounwind {
f<int>();
- // CHECK: declare void @_Z1fIA2_iEvv()
+ // CHECK: define {{.*}} @_Z1fIA2_iEvv() {
f<int[2]>();
- // CHECK: declare void @_Z1fIfEvv() nounwind
+
+ // CHECK: define {{.*}} @_ZN1SIiE1fEv() nounwind
+ S<int>::f();
+ // CHECK: define {{.*}} @_ZN1SIA2_iE1fEv()
+ // CHECK-NOT: nounwind
+ S<int[2]>::f();
+
+ // CHECK: define {{.*}} @_Z1fIfEvv() nounwind {
void (*f1)() = &f<float>;
- // CHECK: declare void @_Z1fIdEvv()
+ // CHECK: define {{.*}} @_Z1fIdEvv() {
void (*f2)() = &f<double>;
- // CHECK: declare void @_Z1fIA4_cEvv() nounwind
+
+ // CHECK: define {{.*}} @_ZN1SIfE1fEv() nounwind
+ void (*f3)() = &S<float>::f;
+ // CHECK: define {{.*}} @_ZN1SIdE1fEv()
+ // CHECK-NOT: nounwind
+ void (*f4)() = &S<double>::f;
+
+ // CHECK: define {{.*}} @_Z1fIA4_cEvv() nounwind {
(void)&f<char[4]>;
- // CHECK: declare void @_Z1fIcEvv()
+ // CHECK: define {{.*}} @_Z1fIcEvv() {
(void)&f<char>;
+
+ // CHECK: define {{.*}} @_ZN1SIA4_cE1fEv() nounwind
+ (void)&S<char[4]>::f;
+ // CHECK: define {{.*}} @_ZN1SIcE1fEv()
+ // CHECK-NOT: nounwind
+ (void)&S<char>::f;
}
diff --git a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
index 763b9ed41b..d29c8862b9 100644
--- a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
+++ b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
@@ -105,3 +105,16 @@ namespace core_19754_example {
base<types> val = base<types>();
}
+
+namespace pr9485 {
+ template <typename T> void f1(T) throw(typename T::exception); // expected-note {{candidate}}
+ template <typename T> void f1(T, int = 0) throw(typename T::noitpecxe); // expected-note {{candidate}}
+
+ template <typename T> void f2(T) noexcept(T::throws); // expected-note {{candidate}}
+ template <typename T> void f2(T, int = 0) noexcept(T::sworht); // expected-note {{candidate}}
+
+ void test() {
+ f1(0); // expected-error {{ambiguous}}
+ f2(0); // expected-error {{ambiguous}}
+ }
+}