diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-03-09 08:16:49 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-03-09 08:16:49 +0000 |
commit | 58ec3cc5c0c441e0e8c49c029be9e25dcb1d853d (patch) | |
tree | 4053bda91421405c7881ecbb817f38fb71ebe500 /gcc/cp/init.c | |
parent | f1c4ca32d04cf16aa78c857acca00f7eebb9b9da (diff) | |
download | gcc-58ec3cc5c0c441e0e8c49c029be9e25dcb1d853d.zip gcc-58ec3cc5c0c441e0e8c49c029be9e25dcb1d853d.tar.gz gcc-58ec3cc5c0c441e0e8c49c029be9e25dcb1d853d.tar.bz2 |
re PR c++/14401 (Uninitialized reference error not reported.)
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.
From-SVN: r79158
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 4a31bd5..60a4d04 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 |