aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-03-05 17:17:13 -0500
committerJason Merrill <jason@gcc.gnu.org>2019-03-05 17:17:13 -0500
commitdbcd32f889365695b3ed835a3a7de5d23048f43b (patch)
tree96f919af96a1d63fd5318191f716d125ff4b1c04 /gcc/cp/init.c
parent9bf54c938ab8ab79a92a5f354686e103d66f1a1a (diff)
downloadgcc-dbcd32f889365695b3ed835a3a7de5d23048f43b.zip
gcc-dbcd32f889365695b3ed835a3a7de5d23048f43b.tar.gz
gcc-dbcd32f889365695b3ed835a3a7de5d23048f43b.tar.bz2
re PR c++/86485 ("anonymous" maybe-uninitialized false positive with ternary operator)
* class.c (is_really_empty_class): Add ignore_vptr parm. While looking at PR86485, I noticed that many uses of is_really_empty_class were overlooking that it returned true for a class with only a vptr; initialization of such a class is not trivial. Marek's P1064 patch fixed one place in constexpr.c to also check for a vtable, but there are several others that still don't. This patch requires callers to explicitly choose which behavior they want. Currently the uses in constexpr.c want to consider the vptr, and other uses don't. * class.c (is_really_empty_class): Add ignore_vptr parm. (trivial_default_constructor_is_constexpr): Pass it. * call.c (build_over_call): Pass it. * constexpr.c (cxx_eval_constant_expression): Pass it instead of checking TYPE_POLYMORPHIC_P. (cxx_eval_component_reference, potential_constant_expression_1): Pass it. * cp-gimplify.c (simple_empty_class_p): Pass it. * init.c (expand_aggr_init_1): Pass it. From-SVN: r269402
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 606d246..eb3b504 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2058,7 +2058,7 @@ expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags,
/* If the type has data but no user-provided ctor, we need to zero
out the object. */
if (!type_has_user_provided_constructor (type)
- && !is_really_empty_class (type))
+ && !is_really_empty_class (type, /*ignore_vptr*/true))
{
tree field_size = NULL_TREE;
if (exp != true_exp && CLASSTYPE_AS_BASE (type) != type)