50 lines · cpp
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-CXX112// 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-CXX173 4// CHECK: define {{.*}} @_Z1aPFivE(5void a(int() throw(int, float)) {}6// CHECK-CXX11: define {{.*}} @_Z1bPFivE(7// CHECK-CXX17: define {{.*}} @_Z1bPDoFivE(8void b(int() noexcept) {}9// CHECK-CXX11: define {{.*}} @_Z1cPFivE(10// CHECK-CXX17: define {{.*}} @_Z1cPDoFivE(11void c(int() throw()) {}12// CHECK: define {{.*}} @_Z1dPFivE(13void d(int() noexcept(false)) {}14// CHECK-CXX11: define {{.*}} @_Z1ePFivE(15// CHECK-CXX17: define {{.*}} @_Z1ePDoFivE(16void e(int() noexcept(true)) {}17 18template<bool B> void f(int() noexcept(B)) {}19// CHECK: define {{.*}} @_Z1fILb0EEvPDOT_EFivE(20template void f<false>(int());21// CHECK: define {{.*}} @_Z1fILb1EEvPDOT_EFivE(22template void f<true>(int() noexcept);23 24template<typename...T> void g(int() throw(T...)) {}25// CHECK: define {{.*}} @_Z1gIJEEvPDwDpT_EFivE(26template void g<>(int() noexcept);27// CHECK: define {{.*}} @_Z1gIJfEEvPDwDpT_EFivE(28template void g<float>(int());29 30// We consider the exception specifications in parameter and return type here31// to be different.32template<typename...T> auto h(int() throw(int, T...)) -> int (*)() throw(T..., int) { return nullptr; }33// CHECK: define {{.*}} @_Z1hIJEEPDwDpT_iEFivEPDwiS1_EFivE(34template auto h<>(int()) -> int (*)();35// CHECK: define {{.*}} @_Z1hIJfEEPDwDpT_iEFivEPDwiS1_EFivE(36template auto h<float>(int()) -> int (*)();37 38// FIXME: The C++11 manglings here are wrong; they should be the same as the39// C++17 manglings.40// The mangler mishandles substitutions for instantiation-dependent types that41// 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 {{.*}} @_Z1iIJEEPDwiDpT_EFivEPS2_(45// CHECK-CXX17: define {{.*}} @_Z1iIJEEPDwiDpT_EFivES3_(46template auto i<>(int()) -> int (*)();47// CHECK-CXX11: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivEPS2_(48// CHECK-CXX17: define {{.*}} @_Z1iIJfEEPDwiDpT_EFivES3_(49template auto i<float>(int()) -> int (*)();50