The 3.4 C++ compiler emits two errors on the following code. Only the first one should be emitted (that's the case with gcc 3.3). That's not a serious bug since the second error message disappears when the first one is fixed, but it's disturbing nevertheless. $ cat > foo.cc #include <iostream> void function1() { cout; } using namespace std; void function2() { cout; } $ $ g++ -c foo.cc foo.cc: In function `void function1()': foo.cc:3: error: `cout' undeclared (first use this function) foo.cc:3: error: (Each undeclared identifier is reported only once for each function it appears in.) foo.cc: In function `void function2()': foo.cc:7: error: `cout' undeclared (first use this function) $
Confirmed, a 3.4 regression only.
Postponed until GCC 3.4.4.
Subject: Bug 17609 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: reichelt@gcc.gnu.org 2005-09-21 15:08:00 Modified files: gcc/cp : ChangeLog lex.c name-lookup.c name-lookup.h gcc/testsuite : ChangeLog gcc/testsuite/g++.dg/lookup: ambig4.C koenig1.C used-before-declaration.C gcc/testsuite/g++.dg/ext: stmtexpr4.C gcc/testsuite/g++.dg/other: do1.C gcc/testsuite/g++.dg/overload: koenig1.C gcc/testsuite/g++.dg/parse: crash13.C error21.C Added files: gcc/testsuite/g++.dg/lookup: error1.C Log message: PR c++/17609 Backport: 2004-03-08 Mark Mitchell <mark@codesourcery.com> * lex.c (unqualified_name_lookup_error): Create a dummy VAR_DECL in the innermost scope, rather than at namespace scope. * name-lookup.c (push_local_binding): Give it external linkage. * name-lookup.h (push_local_binding): Declare it. * g++.dg/lookup/error1.C: New test. * g++.dg/lookup/ambig4.C: Tweak error messages. * g++.dg/ext/stmtexpr4.C: Likewise. * g++.dg/parse/error21.C: Tweak testcase. Backport: 2004-03-02 Mark Mitchell <mark@codesourcery.com> * g++.dg/lookup/koenig1.C: Tweak error messages. * g++.dg/lookup/used-before-declaration.C: Likewise. * g++.dg/other/do1.C: Likewise. * g++.dg/overload/koenig1.C: Likewise. * g++.dg/parse/crash13.C: Likewise. 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.242&r2=1.3892.2.243 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/lex.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.323.2.4&r2=1.323.2.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.24&r2=1.34.2.25 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.15.2.3&r2=1.15.2.4 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.436&r2=1.3389.2.437 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/error1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.6.1&r2=1.1.6.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/koenig1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=1.1.22.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/used-before-declaration.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=1.1.12.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/stmtexpr4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.4.1&r2=1.1.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/do1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3&r2=1.3.20.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/koenig1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=1.1.24.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash13.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.14.1&r2=1.1.14.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error21.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.2.1&r2=1.1.2.2
This is now fixed in GCC 3.4.5. The new testcase g++.dg/lookup/error1.C will be added to mainline and the 4.0 branch. In the meantime I'll keep the PR open.
Subject: Bug 17609 CVSROOT: /cvs/gcc Module name: gcc Changes by: reichelt@gcc.gnu.org 2005-09-21 15:21:00 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/lookup: error1.C Log message: PR c++/17609 * g++.dg/lookup/error1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6090&r2=1.6091 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/error1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Testcase now also in mainline. Waiting for 4.0 branch to unfreeze.
Subject: Bug 17609 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: reichelt@gcc.gnu.org 2005-10-05 15:36:28 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/lookup: error1.C Log message: PR c++/17609 * g++.dg/lookup/error1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.429&r2=1.5084.2.430 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/error1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.10.1
Testcase now also on the 4.0 branch.