This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH: PR c++/7228
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 23 Oct 2002 22:40:48 -0400
- Subject: Re: C++ PATCH: PR c++/7228
A patch to add the guards is appended, but if those macros always
should be guarded with a test that the lang_type structure exists, then it
probably should be subsumed into the macro and separate
SET_CLASSTYPE_... macros created for setting the fields. Having to
remember to test for the lang_type structure is errorprone, as this PR
demonstrates.
David
* cp/decl.c (check_initializer): Ensure lang_type structure exists
before accessing with CLASSTYPE macros.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.952
diff -c -p -r1.952 decl.c
*** decl.c 21 Oct 2002 16:47:12 -0000 1.952
--- decl.c 24 Oct 2002 02:35:38 -0000
*************** check_initializer (tree decl, tree init,
*** 8062,8070 ****
{
tree core_type = strip_array_types (type);
! if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized const members", decl);
! if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized reference members",
decl);
--- 8062,8072 ----
{
tree core_type = strip_array_types (type);
! if (TYPE_LANG_SPECIFIC (core_type)
! && CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized const members", decl);
! if (TYPE_LANG_SPECIFIC (core_type)
! && CLASSTYPE_REF_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized reference members",
decl);