Files
clang-p2996/clang/test/CodeGenCXX/vararg-non-pod.cpp
Douglas Gregor 347e0f26be 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.

llvm-svn: 131805
2011-05-21 19:26:31 +00:00

17 lines
266 B
C++

// 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
}