Commit 5fdbceff by Paolo Carlini Committed by Paolo Carlini

re PR c++/56534 (ICE Segfault on invalid code in check_elaborated_type_specifier)

/cp
2013-03-06  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/56534
	* parser.c (cp_parser_elaborated_type_specifier): Don't call
	check_elaborated_type_specifier when TREE_CODE (decl) != TYPE_DECL.
	* decl.c (check_elaborated_type_specifier): Tidy.

/testsuite
2013-03-06  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/56534
	* g++.dg/template/crash115.C: New.

From-SVN: r196513
parent 01a454df
2013-03-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56534
* parser.c (cp_parser_elaborated_type_specifier): Don't call
check_elaborated_type_specifier when TREE_CODE (decl) != TYPE_DECL.
* decl.c (check_elaborated_type_specifier): Tidy.
2013-03-06 Jakub Jelinek <jakub@redhat.com> 2013-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/56543 PR c++/56543
......
...@@ -11712,9 +11712,6 @@ check_elaborated_type_specifier (enum tag_types tag_code, ...@@ -11712,9 +11712,6 @@ check_elaborated_type_specifier (enum tag_types tag_code,
{ {
tree type; tree type;
if (decl == error_mark_node)
return error_mark_node;
/* In the case of: /* In the case of:
struct S { struct S *p; }; struct S { struct S *p; };
......
...@@ -14248,12 +14248,14 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, ...@@ -14248,12 +14248,14 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
typename_type, typename_type,
/*complain=*/tf_error); /*complain=*/tf_error);
/* If the `typename' keyword is in effect and DECL is not a type /* If the `typename' keyword is in effect and DECL is not a type
decl. Then type is non existant. */ decl, then type is non existent. */
else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL) else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL)
type = NULL_TREE; ;
else else if (TREE_CODE (decl) == TYPE_DECL)
type = check_elaborated_type_specifier (tag_type, decl, type = check_elaborated_type_specifier (tag_type, decl,
/*allow_template_p=*/true); /*allow_template_p=*/true);
else if (decl == error_mark_node)
type = error_mark_node;
} }
if (!type) if (!type)
......
2013-03-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56534
* g++.dg/template/crash115.C: New.
2013-03-06 Jakub Jelinek <jakub@redhat.com> 2013-03-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/56539 PR tree-optimization/56539
......
// PR c++/56534
template < struct template rebind < > // { dg-error "expected" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment