re PR c++/65954 (gcc segfaults on the following input with a syntax error)

cp/
	PR c++/65954
	* typeck.c (finish_class_member_access_expr): Diagnose failed
	lookup of enum class member.

	testsuite/
	* g++.dg/cpp0x/pr65954.C: New.

From-SVN: r223430
This commit is contained in:
Nathan Sidwell 2015-05-20 01:54:09 +00:00 committed by Nathan Sidwell
parent 261640d521
commit 09b59d4de6
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2015-05-19 Nathan sidwell <nathan@acm.org>
PR c++/65954
* typeck.c (finish_class_member_access_expr): Diagnose failed
lookup of enum class member.
2015-05-19 Jakub Jelinek <jakub@redhat.com>
PR middle-end/66199

View File

@ -2731,6 +2731,14 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
return error_mark_node;
}
tree val = lookup_enumerator (scope, name);
if (!val)
{
if (complain & tf_error)
error ("%qD is not a member of %qD",
name, scope);
return error_mark_node;
}
if (TREE_SIDE_EFFECTS (object))
val = build2 (COMPOUND_EXPR, TREE_TYPE (val), object, val);
return val;

View File

@ -1,3 +1,7 @@
2015-05-19 Nathan sidwell <nathan@acm.org>
* g++.dg/cpp0x/pr65954.C: New.
2015-05-20 Oleg Endo <olegendo@gcc.gnu.org>
* gcc.target/sh/pr64366.c: Remove -m4 -ml from dg-options.

View File

@ -0,0 +1,12 @@
// { dg-do compile { target c++11 } }
struct Shape {
enum class Type
{ Circle, Square };
};
void Foo (Shape &shape)
{
+shape.Type::NOPE; // { dg-error "is not a member of" }
}