]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/13683 (bogus warning about passing non-PODs through ellipsis)
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Fri, 30 Jan 2004 18:20:54 +0000 (18:20 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Fri, 30 Jan 2004 18:20:54 +0000 (18:20 +0000)
PR c++/13683
* call.c (convert_arg_to_ellipsis): Don't emit a warning if within
a sizeof expression.block

From-SVN: r76980

gcc/cp/ChangeLog
gcc/cp/call.c

index 65a2fb5c6bc7e7eb23a5dfbdadd5b3cfed0a48e1..8aac4caefada6e73fe13ed9a73fe015feb274861 100644 (file)
@@ -1,23 +1,29 @@
+2004-01-30  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/13683
+       * call.c (convert_arg_to_ellipsis): Don't emit a warning if within
+       a sizeof expression.block
+
 2004-01-29  Aldy Hernandez  <aldyh@redhat.com>
-                                                                                
-        Backport:
-                                                                                
-        2004-01-17  Fred Fish  <fnf@intrinsity.com>
-                                                                                
-        PR c++/11895
-        * cp/decl.c (reshape_init): Handle VECTOR_TYPE like ARRAY_TYPE,
-        except don't call array_type_nelts() with a VECTOR_TYPE.
+
+       Backport:
+
+       2004-01-17  Fred Fish  <fnf@intrinsity.com>
+
+       PR c++/11895
+       * cp/decl.c (reshape_init): Handle VECTOR_TYPE like ARRAY_TYPE,
+       except don't call array_type_nelts() with a VECTOR_TYPE.
 
 2004-01-29  Aldy Hernandez  <aldyh@redhat.com>
 
        Backport:
        2003-06-03  Jason Merrill  <jason@redhat.com>
-                                                                                
-        * cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.
-                                                                                
-        * cp/decl.c (reshape_init): Handle vectors.
-                                                                                
-        * testsuite/g++.dg/init/array10.C: New.
+
+       * cp/cp-tree.h (CP_AGGREGATE_TYPE_P): Accept vectors.
+
+       * cp/decl.c (reshape_init): Handle vectors.
+
+       * testsuite/g++.dg/init/array10.C: New.
 
 2004-01-25  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
index b16677f80131cd52cb6687411995793795c4b8c9..ce90678659942a4dae52e8da933b53e9f8f27f88 100644 (file)
@@ -4308,16 +4308,20 @@ convert_arg_to_ellipsis (arg)
 
   arg = require_complete_type (arg);
   
-  if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg)))
-    {
-      /* Undefined behavior [expr.call] 5.2.2/7.  We used to just warn
-        here and do a bitwise copy, but now cp_expr_size will abort if we
-        try to do that.  */
-      warning ("cannot pass objects of non-POD type `%#T' through `...'; \
-call will abort at runtime",
-              TREE_TYPE (arg));
-      arg = call_builtin_trap ();
-    }
+  if (arg != error_mark_node\r
+      && !pod_type_p (TREE_TYPE (arg)))\r
+    {\r
+      /* Undefined behavior [expr.call] 5.2.2/7.  We used to just warn\r
+        here and do a bitwise copy, but now cp_expr_size will abort if we\r
+        try to do that.\r
+        If the call appears in the context of a sizeof expression,\r
+        there is no need to emit a warning, since the expression won't be\r
+        evaluated. We keep the builtin_trap just as a safety check.  */\r
+      if (!skip_evaluation)\r
+       warning ("cannot pass objects of non-POD type `%#T' through `...'; "\r
+                "call will abort at runtime", TREE_TYPE (arg));\r
+      arg = call_builtin_trap ();\r
+    }\r
 
   return arg;
 }