OSDN Git Service

PR c++/13683
authorgiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jan 2004 15:08:37 +0000 (15:08 +0000)
committergiovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jan 2004 15:08:37 +0000 (15:08 +0000)
* call.c (convert_arg_to_ellipsis): Don't emit a warning if within
a sizeof expression.block

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76963 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 19e787e..0ffb1bf 100644 (file)
@@ -1,3 +1,9 @@
+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  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/13883
index ea494c7..d391b29 100644 (file)
@@ -4127,14 +4127,18 @@ convert_arg_to_ellipsis (tree arg)
 
   arg = require_complete_type (arg);
   
-  if (arg != error_mark_node && ! pod_type_p (TREE_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));
+        try to do that. 
+        If the call appears in the context of a sizeof expression, 
+        there is no need to emit a warning, since the expression won't be 
+        evaluated. We keep the builtin_trap just as a safety check.  */
+      if (!skip_evaluation)
+       warning ("cannot pass objects of non-POD type `%#T' through `...'; "
+                "call will abort at runtime", TREE_TYPE (arg));
       arg = call_builtin_trap (TREE_TYPE (arg));
     }