Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.

llvm-svn: 91094
This commit is contained in:
Chris Lattner 2009-12-11 01:52:50 +00:00
parent a581aacdce
commit 56caf31afb
4 changed files with 9 additions and 8 deletions

View File

@ -2009,7 +2009,8 @@ def err_cannot_pass_objc_interface_to_vararg : Error<
def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
"cannot pass object of non-POD type %0 through variadic "
"%select{function|block|method|constructor}1; call will abort at runtime">;
"%select{function|block|method|constructor}1; call will abort at runtime">,
InGroup<DiagGroup<"non-pod-varargs">>, DefaultError;
def err_typecheck_call_invalid_ordered_compare : Error<
"ordered compare requires two args of floating point type (%0 and %1)">;

View File

@ -1,4 +1,4 @@
// RUN: clang-cc -fsyntax-only %s
// RUN: clang-cc -fsyntax-only %s -Wnon-pod-varargs
class X { };
int& copycon(X x);
@ -23,10 +23,10 @@ float& copycon2(...);
void test_copycon2(A a, const A ac, B b, B const bc, B volatile bv) {
int& i1 = copycon2(b);
float& f1 = copycon2(bc);
float& f2 = copycon2(bv);
float& f1 = copycon2(bc); // expected-warning {{cannot pass object of non-POD type}}
float& f2 = copycon2(bv); // expected-warning {{cannot pass object of non-POD type}}
short& s1 = copycon2(a);
float& f3 = copycon2(ac);
float& f3 = copycon2(ac); // expected-warning {{cannot pass object of non-POD type}}
}
int& copycon3(A a);
@ -34,7 +34,7 @@ float& copycon3(...);
void test_copycon3(B b, const B bc) {
int& i1 = copycon3(b);
float& f1 = copycon3(bc);
float& f1 = copycon3(bc); // expected-warning {{cannot pass object of non-POD type}}
}

View File

@ -1,4 +1,4 @@
// RUN: clang-cc -fsyntax-only -verify -fblocks %s
// RUN: clang-cc -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
extern char version[];

View File

@ -1,4 +1,4 @@
// RUN: clang-cc -fsyntax-only -verify %s
// RUN: clang-cc -fsyntax-only -verify %s -Wnon-pod-varargs
extern char version[];