Commit c10bffd0 by Jason Merrill Committed by Jason Merrill

class.c (check_field_decls): Complain about non-static data members with same…

class.c (check_field_decls): Complain about non-static data members with same name as class in class with...

        * class.c (check_field_decls): Complain about non-static data
        members with same name as class in class with constructor.

From-SVN: r33856
parent b58c068a
2000-05-11 Jason Merrill <jason@casey.cygnus.com>
* class.c (check_field_decls): Complain about non-static data
members with same name as class in class with constructor.
2000-05-10 Jason Merrill <jason@casey.cygnus.com> 2000-05-10 Jason Merrill <jason@casey.cygnus.com>
* decl.c (grokdeclarator): Allow non-static data members with * decl.c (grokdeclarator): Allow non-static data members with
......
...@@ -3442,6 +3442,13 @@ check_field_decls (t, access_decls, empty_p, ...@@ -3442,6 +3442,13 @@ check_field_decls (t, access_decls, empty_p,
|= CLASSTYPE_READONLY_FIELDS_NEED_INIT (type); |= CLASSTYPE_READONLY_FIELDS_NEED_INIT (type);
} }
/* Core issue 80: A nonstatic data member is required to have a
different name from the class iff the class has a
user-defined constructor. */
if (DECL_NAME (x) == constructor_name (t)
&& TYPE_HAS_CONSTRUCTOR (t))
cp_error_at ("field `%#D' with same name as class", x);
/* We set DECL_C_BIT_FIELD in grokbitfield. /* We set DECL_C_BIT_FIELD in grokbitfield.
If the type and width are valid, we'll also set DECL_BIT_FIELD. */ If the type and width are valid, we'll also set DECL_BIT_FIELD. */
if (DECL_C_BIT_FIELD (x)) if (DECL_C_BIT_FIELD (x))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment