blob: 1b4d8135bb44fdcd7a2623486dbcd131c5c4fc55 [file] [log] [blame]
Richard Smithfda59e52016-10-26 01:05:54 +00001// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | 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 | FileCheck %s --check-prefix CHECK --check-prefix CHECK-CXX17
3
4// CHECK: define {{.*}} @_Z1aPFivE(
5void a(int() throw(int, float)) {}
6// CHECK-CXX11: define {{.*}} @_Z1bPFivE(
7// CHECK-CXX17: define {{.*}} @_Z1bPnxFivE(
8void b(int() noexcept) {}
9// CHECK-CXX11: define {{.*}} @_Z1cPFivE(
10// CHECK-CXX17: define {{.*}} @_Z1cPnxFivE(
11void c(int() throw()) {}
12// CHECK: define {{.*}} @_Z1dPFivE(
13void d(int() noexcept(false)) {}
14// CHECK-CXX11: define {{.*}} @_Z1ePFivE(
15// CHECK-CXX17: define {{.*}} @_Z1ePnxFivE(
16void e(int() noexcept(true)) {}
17
18template<bool B> void f(int() noexcept(B)) {}
19// CHECK: define {{.*}} @_Z1fILb0EEvPnXT_EFivE(
20template void f<false>(int());
21// CHECK: define {{.*}} @_Z1fILb1EEvPnXT_EFivE(
22template void f<true>(int() noexcept);
23
24template<typename...T> void g(int() throw(T...)) {}
25// CHECK: define {{.*}} @_Z1gIJEEvPtwDpT_EFivE(
26template void g<>(int() noexcept);
27// CHECK: define {{.*}} @_Z1gIJfEEvPtwDpT_EFivE(
28template void g<float>(int());
29
30// We consider the exception specifications in parameter and return type here
31// to be different.
32template<typename...T> auto h(int() throw(int, T...)) -> int (*)() throw(T..., int) { return nullptr; }
33// CHECK: define {{.*}} @_Z1hIJEEPtwDpT_iEFivEPtwiS1_EFivE(
34template auto h<>(int()) -> int (*)();
35// CHECK: define {{.*}} @_Z1hIJfEEPtwDpT_iEFivEPtwiS1_EFivE(
36template 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.)
43template<typename...T> auto i(int() throw(int, T...)) -> int (*)() throw(int, T...) { return nullptr; }
44// CHECK-CXX11: define {{.*}} @_Z1iIJEEPtwiDpT_EFivEPS2_(
45// CHECK-CXX17: define {{.*}} @_Z1iIJEEPtwiDpT_EFivES3_(
46template auto i<>(int()) -> int (*)();
47// CHECK-CXX11: define {{.*}} @_Z1iIJfEEPtwiDpT_EFivEPS2_(
48// CHECK-CXX17: define {{.*}} @_Z1iIJfEEPtwiDpT_EFivES3_(
49template auto i<float>(int()) -> int (*)();