xref: /llvm-project/clang/test/CodeGenCXX/mangle-fail.cpp (revision 7e9c23352945af72227481e03d3a3f388de6ab46)
1 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=1
2 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple %itanium_abi_triple -verify %s -DN=2
3 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple arm64-apple-ios -fptrauth-intrinsics -verify %s -DN=3
4 // RUN: %clang_cc1 -emit-llvm-only -x c++ -std=c++11 -triple aarch64-linux-gnu -fptrauth-intrinsics -verify %s -DN=3
5 
6 struct A { int a; };
7 
8 #if N == 1
9 // ChooseExpr
10 template<class T> void test(int (&)[sizeof(__builtin_choose_expr(true, 1, 1), T())]) {} // expected-error {{cannot yet mangle}}
11 template void test<int>(int (&)[sizeof(int)]);
12 
13 #elif N == 2
14 // CompoundLiteralExpr
15 template<class T> void test(int (&)[sizeof((A){}, T())]) {} // expected-error {{cannot yet mangle}}
16 template void test<int>(int (&)[sizeof(A)]);
17 
18 #elif N == 3
19 // __builtin_ptrauth_type_discriminator
20 template <class T, unsigned disc>
21 struct S1 {};
22 
23 template<class T>
24 void func(S1<T, __builtin_ptrauth_type_discriminator(T)> s1) { // expected-error {{cannot yet mangle __builtin_ptrauth_type_discriminator expression}}
25 }
26 
27 void testfunc1() {
28   func(S1<int(), __builtin_ptrauth_type_discriminator(int())>());
29 }
30 
31 // FIXME: There are several more cases we can't yet mangle.
32 
33 #else
34 #error unknown N
35 #endif
36