]> granicus.if.org Git - clang/commitdiff
Give the "cannot pass object of non-POD type 'class C' through variadic constructor...
authorChris Lattner <sabre@nondot.org>
Fri, 11 Dec 2009 01:52:50 +0000 (01:52 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Dec 2009 01:52:50 +0000 (01:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91094 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/SemaCXX/overload-call-copycon.cpp
test/SemaCXX/vararg-non-pod.cpp
test/SemaObjCXX/vararg-non-pod.mm

index 8739890c9ace3ea70467101cd6f8add95b75363e..ef7b0ded166f7f5917c789e5fcef99298a52a453 100644 (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)">;
index 755e27adbac8a7286c87962c12f8e56aa33abab0..6436236b81e9873e167b6fd449ad385fc2f9145c 100644 (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}}
 }
 
 
index 977df144fa11ba83503969857638d7e01c43bfa3..c34f8d0b8f1d9d0a5402a878395c97911fdda062 100644 (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[];
 
index eeed09e61637b2440753c453e505360eb6b4b297..83cbaf807155180154338be11fded2a175ae6f98 100644 (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[];