decl.c (grokdeclarator): Allow non-static data members with same name as class.

* decl.c (grokdeclarator): Allow non-static data members with
        same name as class.

From-SVN: r33827
This commit is contained in:
Jason Merrill 2000-05-10 17:48:30 +00:00 committed by Jason Merrill
parent 0d12ea9719
commit e54930f9a3
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2000-05-10 Jason Merrill <jason@casey.cygnus.com>
* decl.c (grokdeclarator): Allow non-static data members with
same name as class.
2000-05-09 Zack Weinberg <zack@wolery.cumb.org>
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,

View File

@ -11393,11 +11393,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* 9.2p13 [class.mem] */
if (declarator == constructor_name (current_class_type)
/* Divergence from the standard: In extern "C", we
allow non-static data members here, because C does
and /usr/include/netinet/in.h uses that. */
&& (staticp || ! in_system_header))
cp_pedwarn ("ISO C++ forbids data member `%D' with same name as enclosing class",
/* The standard does not allow non-static data members
here either, but we agreed at the 10/99 meeting
to change that in TC 1 so that they are allowed in
classes with no user-defined constructors. */
&& staticp)
cp_pedwarn ("ISO C++ forbids static data member `%D' with same name as enclosing class",
declarator);
if (staticp)