From a3879fa1a8ebe123216f5bc5e57cc30a0265e666 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 28 Apr 2014 12:32:06 +0000 Subject: [PATCH] re PR c++/59120 ([c++11] ICE with invalid template alias) /cp 2014-04-28 Paolo Carlini PR c++/59120 * parser.c (cp_parser_alias_declaration): Check return value of cp_parser_require. /testsuite 2014-04-28 Paolo Carlini PR c++/59120 * g++.dg/cpp0x/alias-decl-43.C: New. From-SVN: r209857 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 11 ++--------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/alias-decl-43.C | 4 ++++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-43.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 584046150bc..a5f3829d705 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-04-28 Paolo Carlini + + PR c++/59120 + * parser.c (cp_parser_alias_declaration): Check return value of + cp_parser_require. + 2014-04-24 Jakub Jelinek * parser.c (cp_parser_omp_atomic): Allow seq_cst before diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c1d94ae92b5..962cacedf80 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16142,15 +16142,8 @@ cp_parser_alias_declaration (cp_parser* parser) if (parser->num_template_parameter_lists) parser->type_definition_forbidden_message = saved_message; - if (type == error_mark_node) - { - cp_parser_skip_to_end_of_block_or_statement (parser); - return error_mark_node; - } - - cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON); - - if (cp_parser_error_occurred (parser)) + if (type == error_mark_node + || !cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON)) { cp_parser_skip_to_end_of_block_or_statement (parser); return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba21fed78f3..9cede570bc0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-04-28 Paolo Carlini + + PR c++/59120 + * g++.dg/cpp0x/alias-decl-43.C: New. + 2014-03-27 Thomas Koenig PR fortran/59604 diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-43.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-43.C new file mode 100644 index 00000000000..02eb33643ac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-43.C @@ -0,0 +1,4 @@ +// PR c++/59120 +// { dg-do compile { target c++11 } } + +template using X = int T::T*; // { dg-error "expected" }