Richard Smith | 82da19d | 2016-12-08 02:49:07 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -Wno-dynamic-exception-spec | FileCheck %s --check-prefix CHECK --check-prefix CHECK-CXX11 |
| 2 | // RUN: %clang_cc1 -std=c++1z -emit-llvm %s -o - -triple=x86_64-apple-darwin9 -Wno-dynamic-exception-spec | FileCheck %s --check-prefix CHECK --check-prefix CHECK-CXX17 |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 3 | |
| 4 | // CHECK: define {{.*}} @_Z1aPFivE( |
| 5 | void a(int() throw(int, float)) {} |
| 6 | // CHECK-CXX11: define {{.*}} @_Z1bPFivE( |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 7 | // CHECK-CXX17: define {{.*}} @_Z1bPDoFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 8 | void b(int() noexcept) {} |
| 9 | // CHECK-CXX11: define {{.*}} @_Z1cPFivE( |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 10 | // CHECK-CXX17: define {{.*}} @_Z1cPDoFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 11 | void c(int() throw()) {} |
| 12 | // CHECK: define {{.*}} @_Z1dPFivE( |
| 13 | void d(int() noexcept(false)) {} |
| 14 | // CHECK-CXX11: define {{.*}} @_Z1ePFivE( |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 15 | // CHECK-CXX17: define {{.*}} @_Z1ePDoFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 16 | void e(int() noexcept(true)) {} |
| 17 | |
| 18 | template<bool B> void f(int() noexcept(B)) {} |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 19 | // CHECK: define {{.*}} @_Z1fILb0EEvPDOT_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 20 | template void f<false>(int()); |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 21 | // CHECK: define {{.*}} @_Z1fILb1EEvPDOT_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 22 | template void f<true>(int() noexcept); |
| 23 | |
| 24 | template<typename...T> void g(int() throw(T...)) {} |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 25 | // CHECK: define {{.*}} @_Z1gIJEEvPDwDpT_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 26 | template void g<>(int() noexcept); |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 27 | // CHECK: define {{.*}} @_Z1gIJfEEvPDwDpT_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 28 | template void g<float>(int()); |
| 29 | |
| 30 | // We consider the exception specifications in parameter and return type here |
| 31 | // to be different. |
| 32 | template<typename...T> auto h(int() throw(int, T...)) -> int (*)() throw(T..., int) { return nullptr; } |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 33 | // CHECK: define {{.*}} @_Z1hIJEEPDwDpT_iEFivEPDwiS1_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 34 | template auto h<>(int()) -> int (*)(); |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 35 | // CHECK: define {{.*}} @_Z1hIJfEEPDwDpT_iEFivEPDwiS1_EFivE( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 36 | template auto h<float>(int()) -> int (*)(); |
| 37 | |
| 38 | // FIXME: The C++11 manglings here are wrong; they should be the same as the |
| 39 | // C++17 manglings. |
| 40 | // The mangler mishandles substitutions for instantiation-dependent types that |
| 41 | // differ only in type sugar that is not relevant for mangling. (In this case, |
| 42 | // the types differ in presence/absence of ParenType nodes under the pointer.) |
| 43 | template<typename...T> auto i(int() throw(int, T...)) -> int (*)() throw(int, T...) { return nullptr; } |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 44 | // CHECK-CXX11: define {{.*}} @_Z1iIJEEPDwiDpT_EFivEPS2_( |
| 45 | // CHECK-CXX17: define {{.*}} @_Z1iIJEEPDwiDpT_EFivES3_( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 46 | template auto i<>(int()) -> int (*)(); |
Richard Smith | ef09aa9 | 2016-11-03 00:27:54 +0000 | [diff] [blame] | 47 | // CHECK-CXX11: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivEPS2_( |
| 48 | // CHECK-CXX17: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivES3_( |
Richard Smith | fda59e5 | 2016-10-26 01:05:54 +0000 | [diff] [blame] | 49 | template auto i<float>(int()) -> int (*)(); |