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]
Other format: [Raw text]

C++ PATCH for c++/28513


We had calls to maybe_note_name_used_in_class in cp_parser_nonclass_name and cp_parser_simple_type_specifier, but not cp_parser_class_name for some reason.

Tested x86_64-pc-linux-gnu, applied to trunk. Doesn't seem like a serious enough bug to apply to older branches.
2008-11-20  Jason Merrill  <jason@redhat.com>

	PR c++/28513
cp/
	* parser.c (cp_parser_class_name): Call maybe_note_name_used_in_class.
testsuite/
	* g++.dg/lookup/name-clash7.C: New test.

Index: cp/parser.c
===================================================================
*** cp/parser.c	(revision 142052)
--- cp/parser.c	(working copy)
*************** cp_parser_class_name (cp_parser *parser,
*** 14767,14772 ****
--- 14767,14775 ----
  		}
  	      return error_mark_node;
  	    }
+ 	  else if (decl != error_mark_node
+ 		   && !parser->scope)
+ 	    maybe_note_name_used_in_class (identifier, decl);
  	}
      }
    else
Index: testsuite/g++.dg/lookup/name-clash7.C
===================================================================
*** testsuite/g++.dg/lookup/name-clash7.C	(revision 0)
--- testsuite/g++.dg/lookup/name-clash7.C	(revision 0)
***************
*** 0 ****
--- 1,11 ----
+ // PR c++/28513
+ 
+ class foo {			// { dg-error "changes meaning" }
+ public:
+   typedef int bar;
+ };
+ 
+ class baz {
+ public:
+   foo::bar foo;			// { dg-error "declaration" }
+ };

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