From 064fd5a8d077d62dc4c0cf962f2b70b44cdb9a7f Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 4 Mar 2014 10:52:18 +0000 Subject: [PATCH] re PR c++/60376 ([c++1y] ICE on invalid with using declaration in template function) /gcc/cp 2014-03-04 Paolo Carlini PR c++/60376 * parser.c (cp_parser_using_declaration): Early return when cp_parser_nested_name_specifier errors out. /gcc/testsuite 2014-03-04 Paolo Carlini PR c++/60376 * g++.dg/cpp1y/pr60376.C: New. /libstdc++-v3 2014-03-04 Paolo Carlini PR c++/60376 * testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Adjust dg-error directives. From-SVN: r208309 --- gcc/cp/ChangeLog | 6 +++ gcc/cp/parser.c | 15 ++++-- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/cpp1y/pr60376.C | 12 +++++ libstdc++-v3/ChangeLog | 6 +++ .../headers/atomic/types_std_c++0x_neg.cc | 47 ------------------- 6 files changed, 40 insertions(+), 51 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60376.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2d8364b6c4f..0a12700bebc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-03-04 Paolo Carlini + + PR c++/60376 + * parser.c (cp_parser_using_declaration): Early return when + cp_parser_nested_name_specifier errors out. + 2014-03-01 Adam Butcher PR c++/60377 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8c7826244b3..413ada64aba 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -15932,10 +15932,17 @@ cp_parser_using_declaration (cp_parser* parser, /* If we saw `typename', or didn't see `::', then there must be a nested-name-specifier present. */ if (typename_p || !global_scope_p) - qscope = cp_parser_nested_name_specifier (parser, typename_p, - /*check_dependency_p=*/true, - /*type_p=*/false, - /*is_declaration=*/true); + { + qscope = cp_parser_nested_name_specifier (parser, typename_p, + /*check_dependency_p=*/true, + /*type_p=*/false, + /*is_declaration=*/true); + if (!qscope && !cp_parser_uncommitted_to_tentative_parse_p (parser)) + { + cp_parser_skip_to_end_of_block_or_statement (parser); + return false; + } + } /* Otherwise, we could be in either of the two productions. In that case, treat the nested-name-specifier as optional. */ else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d9c3854d28..3a683dbea45 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-04 Paolo Carlini + + PR c++/60376 + * g++.dg/cpp1y/pr60376.C: New. + 2014-03-04 Rainer Orth * g++.dg/abi/anon2.C: Don't scan assembler for c++98. diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60376.C b/gcc/testsuite/g++.dg/cpp1y/pr60376.C new file mode 100644 index 00000000000..77efdc583af --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60376.C @@ -0,0 +1,12 @@ +// PR c++/60376 +// { dg-options -std=c++1y } + +struct A +{ + int foo(); +}; + +template void bar() +{ + using (A().foo); // { dg-error "expected" } +} diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2918b9c7c1a..382d3ac368b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2014-03-04 Paolo Carlini + + PR c++/60376 + * testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: + Adjust dg-error directives. + 2014-02-26 Tim Shen * include/bits/regex.tcc (match_results<>::format, diff --git a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc index dfae6798361..08912aa917c 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc @@ -121,50 +121,3 @@ void test01() // { dg-error "expected nested-name-specifier" "" { target *-*-* } 72 } // { dg-error "expected nested-name-specifier" "" { target *-*-* } 73 } // { dg-error "expected nested-name-specifier" "" { target *-*-* } 75 } - -// { dg-error "declared" "" { target *-*-* } 26 } -// { dg-error "declared" "" { target *-*-* } 27 } -// { dg-error "declared" "" { target *-*-* } 28 } -// { dg-error "declared" "" { target *-*-* } 29 } -// { dg-error "declared" "" { target *-*-* } 30 } -// { dg-error "declared" "" { target *-*-* } 31 } -// { dg-error "declared" "" { target *-*-* } 32 } -// { dg-error "declared" "" { target *-*-* } 34 } -// { dg-error "declared" "" { target *-*-* } 36 } -// { dg-error "declared" "" { target *-*-* } 37 } -// { dg-error "declared" "" { target *-*-* } 38 } -// { dg-error "declared" "" { target *-*-* } 39 } -// { dg-error "declared" "" { target *-*-* } 40 } -// { dg-error "declared" "" { target *-*-* } 41 } -// { dg-error "declared" "" { target *-*-* } 42 } -// { dg-error "declared" "" { target *-*-* } 43 } -// { dg-error "declared" "" { target *-*-* } 44 } -// { dg-error "declared" "" { target *-*-* } 45 } -// { dg-error "declared" "" { target *-*-* } 46 } -// { dg-error "declared" "" { target *-*-* } 47 } -// { dg-error "declared" "" { target *-*-* } 48 } -// { dg-error "declared" "" { target *-*-* } 49 } -// { dg-error "declared" "" { target *-*-* } 50 } -// { dg-error "declared" "" { target *-*-* } 52 } -// { dg-error "declared" "" { target *-*-* } 53 } -// { dg-error "declared" "" { target *-*-* } 54 } -// { dg-error "declared" "" { target *-*-* } 55 } -// { dg-error "declared" "" { target *-*-* } 56 } -// { dg-error "declared" "" { target *-*-* } 57 } -// { dg-error "declared" "" { target *-*-* } 58 } -// { dg-error "declared" "" { target *-*-* } 59 } -// { dg-error "declared" "" { target *-*-* } 60 } -// { dg-error "declared" "" { target *-*-* } 61 } -// { dg-error "declared" "" { target *-*-* } 62 } -// { dg-error "declared" "" { target *-*-* } 63 } -// { dg-error "declared" "" { target *-*-* } 64 } -// { dg-error "declared" "" { target *-*-* } 65 } -// { dg-error "declared" "" { target *-*-* } 66 } -// { dg-error "declared" "" { target *-*-* } 67 } -// { dg-error "declared" "" { target *-*-* } 68 } -// { dg-error "declared" "" { target *-*-* } 69 } -// { dg-error "declared" "" { target *-*-* } 70 } -// { dg-error "declared" "" { target *-*-* } 71 } -// { dg-error "declared" "" { target *-*-* } 72 } -// { dg-error "declared" "" { target *-*-* } 73 } -// { dg-error "declared" "" { target *-*-* } 75 }