diff options
author | Jason Merrill <jason@redhat.com> | 2011-09-23 17:30:48 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-09-23 17:30:48 -0400 |
commit | 6132bdd72ebbcea9621519330d07ccb9a8c29f9d (patch) | |
tree | 27fb16e2fc64479b18cb550986fc37b17d95f5ee /gcc/cp/init.c | |
parent | d303ec8e17aa1730e29e5f0666ac82ea131990df (diff) | |
download | gcc-6132bdd72ebbcea9621519330d07ccb9a8c29f9d.zip gcc-6132bdd72ebbcea9621519330d07ccb9a8c29f9d.tar.gz gcc-6132bdd72ebbcea9621519330d07ccb9a8c29f9d.tar.bz2 |
Core 234 - allow const objects with no initializer or user-provided default...
Core 234 - allow const objects with no initializer or
user-provided default constructor if the defaulted constructor
initializes all the subobjects.
PR c++/20039
PR c++/42844
* class.c (default_init_uninitialized_part): New.
* cp-tree.h: Declare it.
* decl.c (check_for_uninitialized_const_var): Use it.
* init.c (perform_member_init): Likewise.
(build_new_1): Likewise.
* method.c (walk_field_subobs): Likewise.
From-SVN: r179130
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index ff1884b..68d4e68 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -579,7 +579,7 @@ perform_member_init (tree member, tree init) flags |= LOOKUP_DEFAULTED; if (CP_TYPE_CONST_P (type) && init == NULL_TREE - && !type_has_user_provided_default_constructor (type)) + && default_init_uninitialized_part (type)) /* TYPE_NEEDS_CONSTRUCTING can be set just because we have a vtable; still give this diagnostic. */ permerror (DECL_SOURCE_LOCATION (current_function_decl), @@ -2088,7 +2088,7 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts, } if (CP_TYPE_CONST_P (elt_type) && *init == NULL - && !type_has_user_provided_default_constructor (elt_type)) + && default_init_uninitialized_part (elt_type)) { if (complain & tf_error) error ("uninitialized const in %<new%> of %q#T", elt_type); |