diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-19 00:08:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-19 00:08:28 +0000 |
commit | d372942d77540ccca7b5c222b3a69da2e37f6498 (patch) | |
tree | 73478f10dcedf61fee5d08ffe84416d16e02dd32 /clang/test/CodeGenCXX/cxx11-exception-spec.cpp | |
parent | 925a6d08c5d405c5fb0d7198b3fee4a8c18a8f07 (diff) | |
download | llvm-d372942d77540ccca7b5c222b3a69da2e37f6498.zip llvm-d372942d77540ccca7b5c222b3a69da2e37f6498.tar.gz llvm-d372942d77540ccca7b5c222b3a69da2e37f6498.tar.bz2 |
PR 12586: Fix assert while running libc++ testsuite: deal with exception
specifications on member function templates of class templates and other such
nested beasties. Store the function template from which we are to instantiate
an exception specification rather than trying to deduce it. Plus some
additional test cases.
llvm-svn: 155076
Diffstat (limited to 'clang/test/CodeGenCXX/cxx11-exception-spec.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx11-exception-spec.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp index 4e08dce..194b80c 100644 --- a/clang/test/CodeGenCXX/cxx11-exception-spec.cpp +++ b/clang/test/CodeGenCXX/cxx11-exception-spec.cpp @@ -3,9 +3,11 @@ void h(); template<typename T> void f() noexcept(sizeof(T) == 4) { h(); } +template<typename T> void g() noexcept(sizeof(T) == 4); template<typename T> struct S { static void f() noexcept(sizeof(T) == 4) { h(); } + static void g() noexcept(sizeof(T) == 4); }; // CHECK: define {{.*}} @_Z1fIsEvv() { @@ -30,7 +32,7 @@ template void S<char16_t>::f(); // CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() nounwind template void S<char16_t[2]>::f(); -void g() { +void h() { // CHECK: define {{.*}} @_Z1fIiEvv() nounwind { f<int>(); // CHECK: define {{.*}} @_Z1fIA2_iEvv() { @@ -64,3 +66,55 @@ void g() { // CHECK-NOT: nounwind (void)&S<char>::f; } + +// CHECK: define {{.*}} @_Z1iv +void i() { + // CHECK: declare {{.*}} @_Z1gIiEvv() nounwind + g<int>(); + // CHECK: declare {{.*}} @_Z1gIA2_iEvv() + // CHECK-NOT: nounwind + g<int[2]>(); + + // CHECK: declare {{.*}} @_ZN1SIiE1gEv() nounwind + S<int>::g(); + // CHECK: declare {{.*}} @_ZN1SIA2_iE1gEv() + // CHECK-NOT: nounwind + S<int[2]>::g(); + + // CHECK: declare {{.*}} @_Z1gIfEvv() nounwind + void (*g1)() = &g<float>; + // CHECK: declare {{.*}} @_Z1gIdEvv() + // CHECK-NOT: nounwind + void (*g2)() = &g<double>; + + // CHECK: declare {{.*}} @_ZN1SIfE1gEv() nounwind + void (*g3)() = &S<float>::g; + // CHECK: declare {{.*}} @_ZN1SIdE1gEv() + // CHECK-NOT: nounwind + void (*g4)() = &S<double>::g; + + // CHECK: declare {{.*}} @_Z1gIA4_cEvv() nounwind + (void)&g<char[4]>; + // CHECK: declare {{.*}} @_Z1gIcEvv() + // CHECK-NOT: nounwind + (void)&g<char>; + + // CHECK: declare {{.*}} @_ZN1SIA4_cE1gEv() nounwind + (void)&S<char[4]>::g; + // CHECK: declare {{.*}} @_ZN1SIcE1gEv() + // CHECK-NOT: nounwind + (void)&S<char>::g; +} + +template<typename T> struct Nested { + template<bool b, typename U> void f() noexcept(sizeof(T) == sizeof(U)); +}; + +// CHECK: define {{.*}} @_Z1jv +void j() { + // CHECK: declare {{.*}} @_ZN6NestedIiE1fILb1EcEEvv( + // CHECK-NOT: nounwind + Nested<int>().f<true, char>(); + // CHECK: declare {{.*}} @_ZN6NestedIlE1fILb0ElEEvv({{.*}}) nounwind + Nested<long>().f<false, long>(); +} |