From 0fcedd9c98d1f9f880b59b979b77f4db4d9eb391 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 3 Feb 2008 22:28:53 -0500 Subject: re PR c++/33916 (Default constructor fails to initialize array members) PR c++/33916 * cp/init.c (build_value_init_1): New function. (build_value_init): New function. * cp/typeck2.c (build_functional_cast): Call it. * cp/cp-gimplify.c (cp_gimplify_init_expr): Handle its output. * cp/cp-tree.h (TYPE_HAS_USER_CONSTRUCTOR): Rename from TYPE_HAS_CONSTRUCTOR. * cp/class.c (finish_struct_bits, maybe_warn_about_overly_private_class, add_implicitly_declared_members): Adjust. (check_field_decls): Adjust. Remove warnings about reference/const in class without constructor. (check_bases_and_members): Adjust. Give those warnings here instead. * cp/decl.c (fixup_anonymous_aggr): Adjust. (check_initializer): Adjust, clarify logic slightly. (grok_special_member_properties): Adjust, only set if user-provided. * cp/rtti.c (create_tinfo_types): Don't set. * cp/cvt.c (ocp_convert): Remove exception for vtable_entry_type et al. Use same_type_ignoring_top_level_qualifiers_p. * cp/pt.c (check_explicit_specialization): Adjust. (instantiate_class_template): Adjust. * print-tree.c (print_node) [CONSTRUCTOR]: Print elements. Co-Authored-By: Mark Mitchell From-SVN: r132088 --- gcc/cp/cvt.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'gcc/cp/cvt.c') diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index ebfc7d0..5f48cc5 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -596,13 +596,9 @@ ocp_convert (tree type, tree expr, int convtype, int flags) e = integral_constant_value (e); - if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP) - /* Some internal structures (vtable_entry_type, sigtbl_ptr_type) - don't go through finish_struct, so they don't have the synthesized - constructors. So don't force a temporary. */ - && TYPE_HAS_CONSTRUCTOR (type)) + if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP)) /* We need a new temporary; don't take this shortcut. */; - else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (e))) + else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e))) { if (same_type_p (type, TREE_TYPE (e))) /* The call to fold will not always remove the NOP_EXPR as @@ -619,10 +615,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) else if (TREE_CODE (e) == TARGET_EXPR) { /* Don't build a NOP_EXPR of class type. Instead, change the - type of the temporary. Only allow this for cv-qual changes, - though. */ - gcc_assert (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (e)), - TYPE_MAIN_VARIANT (type))); + type of the temporary. */ TREE_TYPE (e) = TREE_TYPE (TARGET_EXPR_SLOT (e)) = type; return e; } -- cgit v1.1