reduced test-case: --- foo.cc ---- struct a { int x; }; struct foo { union { ::a a; } u; }; int main(void) { foo bar; retun 0; } ---- end ---- 3.4.0 compiles w/o error. 3.4.1 produces syntax error at declaration of "foo bar". Workaround is to write it as: "struct foo bar;" The "regression hunter" found the error at: 2004-05-15-3.4 (#7) and 2004-06-01-3.4 (#8)
Reduced example, I think this is correct C++ as ::a references to the global type: typedef int a; struct y { ::a a; }; : Search converges between 2004-05-23-trunk (#458) and 2004-06-01-trunk (#459). Most (All) of the changes inbetween that time that went on both the mainline and the 3.4 branch was from Mark.
It sounds like we're talking about two different issues. The initial report is about a problem with the declaration of "bar" in "main". I can't reproduce that on either mainline or with the current 3.4 branch. I do still get an error about the meaning of a name changing, which does indeed look odd. I'm looking into that.
Working on a fix.
If it helps, here's another example, (reduced from ACE 5.2 sources): struct t_bind { }; class ACE_OS_TLI { public: static int t_bind(::t_bind *, ::t_bind *); };
Whoops. Wrong work around in original comment -- sorry. The workaround is to declare struct foo as: struct foo { union { struct a a; } u; };
Subject: Bug 16637 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-07-20 17:27:13 Modified files: gcc/cp : ChangeLog parser.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: lookup4.C Log message: PR c++/16637 * parser.c (cp_parser_simple_type_specifier): Do not record usage of globally-qualified names. PR c++/16637 * g++.dg/parse/lookup4.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.132&r2=1.3892.2.133 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.34&r2=1.157.2.35 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.230&r2=1.3389.2.231 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/lookup4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 16637 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-07-20 17:58:43 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog parser.c Added files: gcc/testsuite/g++.dg/parse: lookup4.C Log message: PR c++/16637 * parser.c (cp_parser_simple_type_specifier): Do not record usage of globally-qualified names. PR c++/16637 * g++.dg/parse/lookup4.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4024&r2=1.4025 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4232&r2=1.4233 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.228&r2=1.229 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/lookup4.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Fixed in GCC 3.4.2.
Closing as fixed.
*** Bug 16846 has been marked as a duplicate of this bug. ***