From 83c4cbbe7bebfd4ff07640a46a417508d68aa6ec Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Fri, 30 Jan 2004 18:20:54 +0000 Subject: [PATCH] re PR c++/13683 (bogus warning about passing non-PODs through ellipsis) 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 | 34 ++++++++++++++++++++-------------- gcc/cp/call.c | 24 ++++++++++++++---------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 65a2fb5c6bc7..8aac4caefada 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,23 +1,29 @@ +2004-01-30 Giovanni Bajo + + 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 - - Backport: - - 2004-01-17 Fred Fish - - 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 + + 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 Backport: 2003-06-03 Jason Merrill - - * 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 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b16677f80131..ce9067865994 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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 + && !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. + 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 (); + } return arg; } -- 2.47.2