This testcase: struct foo { }; struct bar { }; struct baz { static foo (bar)(); }; confuses cp_parser_constructor_declarator_p, which just looks as far as foo (bar) before deciding incorrectly that this is a constructor declarator. This is related to PR 38278, but is a much older issue; it fails as far back as 3.4, though 3.2 seems to accept it.
Mine.
Author: paolo Date: Sun Nov 3 23:49:41 2013 New Revision: 204339 URL: http://gcc.gnu.org/viewcvs?rev=204339&root=gcc&view=rev Log: /cp 2013-11-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/38313 * parser.c (cp_parser_constructor_declarator_p): Check that the class-name matches current_class_type. /testsuite 2013-11-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/38313 * g++.dg/lookup/name-clash10.C: New. Added: trunk/gcc/testsuite/g++.dg/lookup/name-clash10.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.9.0.