re PR c++/51588 ([c++0x] [4.4/4.5/4.6/4.7 Regression] ICE using an enum as base class)

PR c++/51588
	* parser.c (cp_parser_ptr_operator): Reject pointer to member of enum.

From-SVN: r182452
This commit is contained in:
Jason Merrill 2011-12-17 19:55:18 -05:00 committed by Jason Merrill
parent de4d7a7f8d
commit 55f8ed9685
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2011-12-17 Jason Merrill <jason@redhat.com>
PR c++/51588
* parser.c (cp_parser_ptr_operator): Reject pointer to member of enum.
2011-12-17 Richard Henderson <rth@redhat.com>
PR bootstrap/51072

View File

@ -16448,6 +16448,9 @@ cp_parser_ptr_operator (cp_parser* parser,
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
error_at (token->location, "%qD is a namespace", parser->scope);
else if (TREE_CODE (parser->scope) == ENUMERAL_TYPE)
error_at (token->location, "cannot form pointer to member of "
"non-class %q#T", parser->scope);
else
{
/* The type of which the member is a member is given by the

View File

@ -1,5 +1,8 @@
2011-12-17 Jason Merrill <jason@redhat.com>
PR c++/51588
* g++.dg/parse/enum7.C: New.
PR c++/51586
* g++.dg/lookup/nested2.C: New.

View File

@ -0,0 +1,9 @@
// PR c++/51588
enum A {};
struct B : A { // { dg-error "" }
int i;
};
int A::* p = &B::i; // { dg-error "" }