re PR c++/78647 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected tree_list, have error_mark in get_attribute_name, at attribs.c:664))

PR c++/78647
	* c-common.c (attribute_fallthrough_p): Return false for
	error_mark_node.

	* g++.dg/parse/error58.C: New.

From-SVN: r243575
This commit is contained in:
Marek Polacek 2016-12-12 17:58:00 +00:00 committed by Marek Polacek
parent 470a60b2c4
commit fe366b8715
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-12-12 Marek Polacek <polacek@redhat.com>
PR c++/78647
* c-common.c (attribute_fallthrough_p): Return false for
error_mark_node.
2016-12-08 Martin Sebor <msebor@redhat.com> 2016-12-08 Martin Sebor <msebor@redhat.com>
PR c/78284 PR c/78284

View File

@ -5558,6 +5558,8 @@ parse_optimize_options (tree args, bool attr_p)
bool bool
attribute_fallthrough_p (tree attr) attribute_fallthrough_p (tree attr)
{ {
if (attr == error_mark_node)
return false;
tree t = lookup_attribute ("fallthrough", attr); tree t = lookup_attribute ("fallthrough", attr);
if (t == NULL_TREE) if (t == NULL_TREE)
return false; return false;

View File

@ -1,3 +1,8 @@
2016-12-12 Marek Polacek <polacek@redhat.com>
PR c++/78647
* g++.dg/parse/error58.C: New.
2016-12-12 David Malcolm <dmalcolm@redhat.com> 2016-12-12 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/78680 PR preprocessor/78680

View File

@ -0,0 +1,7 @@
// PR c++/78647
// { dg-do compile { target c++11 } }
// { dg-options "-w" }
struct A;
void foo ();
void f() { alignas (foo (A)); } // { dg-error "expected" "" }