diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-03-09 08:16:49 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2004-03-09 08:16:49 +0000 |
commit | 5d89aaedf96358c4794c657fe67f864564aacc31 (patch) | |
tree | 4053bda91421405c7881ecbb817f38fb71ebe500 /gcc/cp/init.c | |
parent | 1fda694ca557b03c9886fbf9c5e75a148d9c7919 (diff) |
PR c++/14401
* class.c (check_field_decls): Complain about non-static data
members of reference type in unions. Propagate
CLASSTYPE_REF_FIELDS_NEED_INIT and
CLASSTYPE_READONLY_FIELDS_NEED_INIT from the types of non-static
data members.
* init.c (perform_member_init): Complain about mbmers with const
type that are not explicitly initialized.
PR c++/14401
* g++.dg/init/ctor3.C: New test.
* g++.dg/init/union1.C: New test.
* g++.dg/ext/anon-struct4.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@79158 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 4a31bd5f017..60a4d047a19 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -371,6 +371,9 @@ perform_member_init (tree member, tree init) /* member traversal: note it leaves init NULL */ else if (TREE_CODE (type) == REFERENCE_TYPE) pedwarn ("uninitialized reference member `%D'", member); + else if (CP_TYPE_CONST_P (type)) + pedwarn ("uninitialized mber `%D' with `const' type `%T'", + member, type); } else if (TREE_CODE (init) == TREE_LIST) /* There was an explicit member initialization. Do some work |