diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 |
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d41a95f..c62f817 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-05-10 Fabien ChĂȘne <fabien.chene@gmail.com> + + PR c++/43719 + * decl.c (check_initializer): strip array type before checking for + uninitialized const or ref members. + 2010-05-07 Fabien ChĂȘne <fabien.chene@gmail.com> PR c++/43951 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 70b1041..4aa3441 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5207,6 +5207,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) { tree type = TREE_TYPE (decl); tree init_code = NULL; + tree core_type; /* Things that are going to be initialized need to have complete type. */ @@ -5318,14 +5319,12 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) check_for_uninitialized_const_var (decl); return build_aggr_init_full_exprs (decl, init, flags); } - else if (MAYBE_CLASS_TYPE_P (type)) + else if (MAYBE_CLASS_TYPE_P (core_type = strip_array_types (type))) { - tree core_type = strip_array_types (type); - - if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)) - error ("structure %qD with uninitialized const members", decl); - if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) - error ("structure %qD with uninitialized reference members", decl); + if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type) + || CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) + diagnose_uninitialized_cst_or_ref_member (core_type, /*using_new=*/false, + /*complain=*/true); check_for_uninitialized_const_var (decl); } |