diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-03-06 23:47:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-03-06 23:47:20 +0000 |
commit | 5fdbceff85d56d29b79bb5746930e6d7af861c65 (patch) | |
tree | 0c8a0ee97b630221c3b32fa66c872104b84b5292 /gcc | |
parent | 01a454df84558c04c49d5f4e31c55cd4267df2bc (diff) | |
download | gcc-5fdbceff85d56d29b79bb5746930e6d7af861c65.zip gcc-5fdbceff85d56d29b79bb5746930e6d7af861c65.tar.gz gcc-5fdbceff85d56d29b79bb5746930e6d7af861c65.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash115.C | 3 |
5 files changed, 21 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8a59234..49e0f51 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +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> PR c++/56543 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 40ab0bd..150e866 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11712,9 +11712,6 @@ check_elaborated_type_specifier (enum tag_types tag_code, { tree type; - if (decl == error_mark_node) - return error_mark_node; - /* In the case of: struct S { struct S *p; }; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 97e610c..ff4faa3 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14248,12 +14248,14 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, typename_type, /*complain=*/tf_error); /* 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) - type = NULL_TREE; - else - type = check_elaborated_type_specifier (tag_type, decl, + ; + else if (TREE_CODE (decl) == TYPE_DECL) + type = check_elaborated_type_specifier (tag_type, decl, /*allow_template_p=*/true); + else if (decl == error_mark_node) + type = error_mark_node; } if (!type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e68863..1979d32 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> PR tree-optimization/56539 diff --git a/gcc/testsuite/g++.dg/template/crash115.C b/gcc/testsuite/g++.dg/template/crash115.C new file mode 100644 index 0000000..5c9f525 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash115.C @@ -0,0 +1,3 @@ +// PR c++/56534 + +template < struct template rebind < > // { dg-error "expected" } |