summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle-fail.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-03-11 00:12:17 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-03-11 00:12:17 +0000
commited1cb88c8af73d9b7810d30004d508c76610d9b9 (patch)
tree0e027b02b1d63f562aafc319684a786abad2b8b5 /clang/test/CodeGenCXX/mangle-fail.cpp
parente93bcd17524981d446eaf99df34204ddb110476c (diff)
downloadbcm5719-llvm-ed1cb88c8af73d9b7810d30004d508c76610d9b9.tar.gz
bcm5719-llvm-ed1cb88c8af73d9b7810d30004d508c76610d9b9.zip
For PR22870: produce an error rather than asserting if a designated initializer appears in a signature.
llvm-svn: 231892
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-fail.cpp')
-rw-r--r--clang/test/CodeGenCXX/mangle-fail.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-fail.cpp b/clang/test/CodeGenCXX/mangle-fail.cpp
new file mode 100644
index 00000000000..e845bcab8a9
--- /dev/null
+++ b/clang/test/CodeGenCXX/mangle-fail.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=1
+// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=2
+// RUN: %clang_cc1 -emit-llvm -x c++ -std=c++11 -verify %s -DN=3
+
+struct A { int a; };
+
+#if N == 1
+// ChooseExpr
+template<class T> void test(int (&)[sizeof(__builtin_choose_expr(true, 1, 1), T())]) {} // expected-error {{cannot yet mangle}}
+template void test<int>(int (&)[sizeof(int)]);
+
+#elif N == 2
+// CompoundLiteralExpr
+template<class T> void test(int (&)[sizeof((A){}, T())]) {} // expected-error {{cannot yet mangle}}
+template void test<int>(int (&)[sizeof(A)]);
+
+#elif N == 3
+// DesignatedInitExpr
+template<class T> void test(int (&)[sizeof(A{.a = 10}, T())]) {} // expected-error {{cannot yet mangle}}
+template void test<int>(int (&)[sizeof(A)]);
+
+// FIXME: There are several more cases we can't yet mangle.
+
+#else
+#error unknown N
+#endif
OpenPOWER on IntegriCloud