Bug 17609 - [3.4 Regression] spurious error message after using keyword
Summary: [3.4 Regression] spurious error message after using keyword
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.2
: P2 minor
Target Milestone: 3.4.5
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2004-09-22 12:45 UTC by papadopo
Modified: 2005-10-05 15:37 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2005-09-10 17:08:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description papadopo 2004-09-22 12:45:30 UTC
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)
$
Comment 1 Andrew Pinski 2004-09-22 13:00:08 UTC
Confirmed, a 3.4 regression only.
Comment 2 Mark Mitchell 2004-11-01 00:46:02 UTC
Postponed until GCC 3.4.4.
Comment 3 GCC Commits 2005-09-21 15:08:21 UTC
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

Comment 4 Volker Reichelt 2005-09-21 15:12:47 UTC
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.
Comment 5 GCC Commits 2005-09-21 15:21:24 UTC
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

Comment 6 Volker Reichelt 2005-09-21 15:23:08 UTC
Testcase now also in mainline.
Waiting for 4.0 branch to unfreeze.
Comment 7 GCC Commits 2005-10-05 15:36:34 UTC
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

Comment 8 Volker Reichelt 2005-10-05 15:37:43 UTC
Testcase now also on the 4.0 branch.