summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/vararg-non-pod.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-21 19:26:31 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-21 19:26:31 +0000
commit930a9abb7eb171d706c9e17a27bbcd267f0d9b3d (patch)
tree2c722de4132a04dc7fa6465b79b5cd62240a9087 /test/CodeGenCXX/vararg-non-pod.cpp
parent4d509341bd5db06a517daa311379f52bb540bc34 (diff)
Fix our handling of the warning when one tries to pass a
non-POD/non-trivial object throuugh a C-style varargs. The warning itself was default-mapped to error, but can be downgraded, but we were treating it in Sema like a hard error, silently dropping the call. Instead, treat this problem like a warning, and do what the warning says we do: abort at runtime. To do so, we fake up a __builtin_trap() expression that gets evaluated as part of the argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131805 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/vararg-non-pod.cpp')
-rw-r--r--test/CodeGenCXX/vararg-non-pod.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGenCXX/vararg-non-pod.cpp b/test/CodeGenCXX/vararg-non-pod.cpp
new file mode 100644
index 0000000000..6c6f459ce5
--- /dev/null
+++ b/test/CodeGenCXX/vararg-non-pod.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -Wno-error=non-pod-varargs -emit-llvm -o - %s | FileCheck %s
+
+struct X {
+ X();
+ X(const X&);
+ ~X();
+};
+
+void vararg(...);
+
+// CHECK: define void @_Z4test1X
+void test(X x) {
+ // CHECK: call void @llvm.trap()
+ vararg(x);
+ // CHECK: ret void
+}