re PR c++/7228 (ICE when using member template and template function)
PR c++/7228 * cp-tree.h (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Check that lang_type structure exists before accessing field. (SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT): New macro. (CLASSTYPE_REF_FIELDS_NEED_INIT): Similar. (SET_CLASSTYPE_REF_FIELDS_NEED_INIT): New macro. * class.c (check_field_decls): Use new macros. * typeck2.c (process_init_constructor): Remove redundant check for existence of lang_type structure. From-SVN: r58533
This commit is contained in:
parent
78fd139e9d
commit
ad3e893dfc
|
@ -1,3 +1,15 @@
|
|||
2002-10-24 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
PR c++/7228
|
||||
* cp-tree.h (CLASSTYPE_READONLY_FIELDS_NEED_INIT): Check that
|
||||
lang_type structure exists before accessing field.
|
||||
(SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT): New macro.
|
||||
(CLASSTYPE_REF_FIELDS_NEED_INIT): Similar.
|
||||
(SET_CLASSTYPE_REF_FIELDS_NEED_INIT): New macro.
|
||||
* class.c (check_field_decls): Use new macros.
|
||||
* typeck2.c (process_init_constructor): Remove redundant check for
|
||||
existence of lang_type structure.
|
||||
|
||||
2002-10-23 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/8067
|
||||
|
|
|
@ -3342,7 +3342,7 @@ check_field_decls (t, access_decls, empty_p,
|
|||
{
|
||||
CLASSTYPE_NON_POD_P (t) = 1;
|
||||
if (DECL_INITIAL (x) == NULL_TREE)
|
||||
CLASSTYPE_REF_FIELDS_NEED_INIT (t) = 1;
|
||||
SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, 1);
|
||||
|
||||
/* ARM $12.6.2: [A member initializer list] (or, for an
|
||||
aggregate, initialization by a brace-enclosed list) is the
|
||||
|
@ -3376,7 +3376,7 @@ check_field_decls (t, access_decls, empty_p,
|
|||
{
|
||||
C_TYPE_FIELDS_READONLY (t) = 1;
|
||||
if (DECL_INITIAL (x) == NULL_TREE)
|
||||
CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = 1;
|
||||
SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t, 1);
|
||||
|
||||
/* ARM $12.6.2: [A member initializer list] (or, for an
|
||||
aggregate, initialization by a brace-enclosed list) is the
|
||||
|
@ -3392,8 +3392,9 @@ check_field_decls (t, access_decls, empty_p,
|
|||
else if (IS_AGGR_TYPE (type))
|
||||
{
|
||||
C_TYPE_FIELDS_READONLY (t) |= C_TYPE_FIELDS_READONLY (type);
|
||||
CLASSTYPE_READONLY_FIELDS_NEED_INIT (t)
|
||||
|= CLASSTYPE_READONLY_FIELDS_NEED_INIT (type);
|
||||
SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t,
|
||||
CLASSTYPE_READONLY_FIELDS_NEED_INIT (t)
|
||||
| CLASSTYPE_READONLY_FIELDS_NEED_INIT (type));
|
||||
}
|
||||
|
||||
/* Core issue 80: A nonstatic data member is required to have a
|
||||
|
|
|
@ -1539,13 +1539,21 @@ struct lang_type
|
|||
#define CLASSTYPE_DECLARED_CLASS(NODE) \
|
||||
(TYPE_LANG_SPECIFIC (NODE)->declared_class)
|
||||
|
||||
/* Nonzero if this class has const members which have no specified initialization. */
|
||||
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
|
||||
(TYPE_LANG_SPECIFIC (NODE)->const_needs_init)
|
||||
/* Nonzero if this class has const members
|
||||
which have no specified initialization. */
|
||||
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
|
||||
(TYPE_LANG_SPECIFIC (NODE) \
|
||||
? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
|
||||
#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
|
||||
(LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
|
||||
|
||||
/* Nonzero if this class has ref members which have no specified initialization. */
|
||||
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
|
||||
(TYPE_LANG_SPECIFIC (NODE)->ref_needs_init)
|
||||
/* Nonzero if this class has ref members
|
||||
which have no specified initialization. */
|
||||
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
|
||||
(TYPE_LANG_SPECIFIC (NODE) \
|
||||
? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
|
||||
#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
|
||||
(LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
|
||||
|
||||
/* Nonzero if this class is included from a header file which employs
|
||||
`#pragma interface', and it is not included in its implementation file. */
|
||||
|
|
|
@ -863,8 +863,7 @@ process_init_constructor (type, init, elts)
|
|||
{
|
||||
if (TREE_READONLY (field))
|
||||
error ("uninitialized const member `%D'", field);
|
||||
else if (TYPE_LANG_SPECIFIC (TREE_TYPE (field))
|
||||
&& CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
|
||||
else if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
|
||||
error ("member `%D' with uninitialized const fields",
|
||||
field);
|
||||
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
|
||||
|
|
Loading…
Reference in New Issue