1*fda59e58SRichard Smith // 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*fda59e58SRichard Smith // 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*fda59e58SRichard Smith 
4*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1aPFivE(
5*fda59e58SRichard Smith void a(int() throw(int, float)) {}
6*fda59e58SRichard Smith // CHECK-CXX11: define {{.*}} @_Z1bPFivE(
7*fda59e58SRichard Smith // CHECK-CXX17: define {{.*}} @_Z1bPnxFivE(
8*fda59e58SRichard Smith void b(int() noexcept) {}
9*fda59e58SRichard Smith // CHECK-CXX11: define {{.*}} @_Z1cPFivE(
10*fda59e58SRichard Smith // CHECK-CXX17: define {{.*}} @_Z1cPnxFivE(
11*fda59e58SRichard Smith void c(int() throw()) {}
12*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1dPFivE(
13*fda59e58SRichard Smith void d(int() noexcept(false)) {}
14*fda59e58SRichard Smith // CHECK-CXX11: define {{.*}} @_Z1ePFivE(
15*fda59e58SRichard Smith // CHECK-CXX17: define {{.*}} @_Z1ePnxFivE(
16*fda59e58SRichard Smith void e(int() noexcept(true)) {}
17*fda59e58SRichard Smith 
18*fda59e58SRichard Smith template<bool B> void f(int() noexcept(B)) {}
19*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1fILb0EEvPnXT_EFivE(
20*fda59e58SRichard Smith template void f<false>(int());
21*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1fILb1EEvPnXT_EFivE(
22*fda59e58SRichard Smith template void f<true>(int() noexcept);
23*fda59e58SRichard Smith 
24*fda59e58SRichard Smith template<typename...T> void g(int() throw(T...)) {}
25*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1gIJEEvPtwDpT_EFivE(
26*fda59e58SRichard Smith template void g<>(int() noexcept);
27*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1gIJfEEvPtwDpT_EFivE(
28*fda59e58SRichard Smith template void g<float>(int());
29*fda59e58SRichard Smith 
30*fda59e58SRichard Smith // We consider the exception specifications in parameter and return type here
31*fda59e58SRichard Smith // to be different.
32*fda59e58SRichard Smith template<typename...T> auto h(int() throw(int, T...)) -> int (*)() throw(T..., int) { return nullptr; }
33*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1hIJEEPtwDpT_iEFivEPtwiS1_EFivE(
34*fda59e58SRichard Smith template auto h<>(int()) -> int (*)();
35*fda59e58SRichard Smith // CHECK: define {{.*}} @_Z1hIJfEEPtwDpT_iEFivEPtwiS1_EFivE(
36*fda59e58SRichard Smith template auto h<float>(int()) -> int (*)();
37*fda59e58SRichard Smith 
38*fda59e58SRichard Smith // FIXME: The C++11 manglings here are wrong; they should be the same as the
39*fda59e58SRichard Smith // C++17 manglings.
40*fda59e58SRichard Smith // The mangler mishandles substitutions for instantiation-dependent types that
41*fda59e58SRichard Smith // differ only in type sugar that is not relevant for mangling. (In this case,
42*fda59e58SRichard Smith // the types differ in presence/absence of ParenType nodes under the pointer.)
43*fda59e58SRichard Smith template<typename...T> auto i(int() throw(int, T...)) -> int (*)() throw(int, T...) { return nullptr; }
44*fda59e58SRichard Smith // CHECK-CXX11: define {{.*}} @_Z1iIJEEPtwiDpT_EFivEPS2_(
45*fda59e58SRichard Smith // CHECK-CXX17: define {{.*}} @_Z1iIJEEPtwiDpT_EFivES3_(
46*fda59e58SRichard Smith template auto i<>(int()) -> int (*)();
47*fda59e58SRichard Smith // CHECK-CXX11: define {{.*}} @_Z1iIJfEEPtwiDpT_EFivEPS2_(
48*fda59e58SRichard Smith // CHECK-CXX17: define {{.*}} @_Z1iIJfEEPtwiDpT_EFivES3_(
49*fda59e58SRichard Smith template auto i<float>(int()) -> int (*)();
50