This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(C++) patch to grokdeclarator


See comment.

2000-05-10  Jason Merrill  <jason@casey.cygnus.com>

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

Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.603
diff -c -p -r1.603 decl.c
*** decl.c	2000/05/09 19:55:50	1.603
--- decl.c	2000/05/10 17:47:18
*************** grokdeclarator (declarator, declspecs, d
*** 11393,11403 ****
  
  	    /* 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",
  			  declarator);
  
  	    if (staticp)
--- 11393,11404 ----
  
  	    /* 9.2p13 [class.mem] */
  	    if (declarator == constructor_name (current_class_type)
! 		/* 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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]