From: Jason Merrill Date: Tue, 4 Mar 2014 22:16:03 +0000 (-0500) Subject: re PR c++/60415 (Bogus "invalid use of qualified-name") X-Git-Tag: releases/gcc-4.9.0~574 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=201fe4c608fea87610940f2e6329f2ae13157cee;p=thirdparty%2Fgcc.git re PR c++/60415 (Bogus "invalid use of qualified-name") PR c++/60415 PR c++/54359 * parser.c (cp_parser_direct_declarator): Set declarator to cp_error_declarator on invalid qualified-id. From-SVN: r208332 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0a12700bebce..2ad6b7a3b59c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2014-03-04 Jason Merrill + + PR c++/60415 + PR c++/54359 + * parser.c (cp_parser_direct_declarator): Set declarator to + cp_error_declarator on invalid qualified-id. + 2014-03-04 Paolo Carlini PR c++/60376 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 413ada64abaf..bb7d2685f121 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17456,6 +17456,7 @@ cp_parser_direct_declarator (cp_parser* parser, /* But declarations with qualified-ids can't appear in a function. */ cp_parser_error (parser, "qualified-id in declaration"); + declarator = cp_error_declarator; break; } pushed_scope = push_scope (scope); diff --git a/gcc/testsuite/g++.dg/parse/ambig8.C b/gcc/testsuite/g++.dg/parse/ambig8.C new file mode 100644 index 000000000000..016df8ae71be --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ambig8.C @@ -0,0 +1,15 @@ +// PR c++/60415 + +namespace b { + enum type_t { warning }; +} + +struct d { + d(b::type_t) { } + int operator()() { return 0; } +}; + +int main() +{ + d(b::warning)() + 1; +}