The following program should not compile, because 'A' is being redeclared in namespace foo via the using declaration (it has already been declared differently in namespace foo): namespace foo { template<typename T> struct A {}; } namespace bar { template<typename T> struct A {}; } namespace foo { using bar::A; }
I can confirm this on the mainline (20030728) and 3.3.1 (20030707). From Phil's regression hunter: Search converges between 2003-03-11-trunk (#242) and 2003- 03-12-trunk (#243). : Search converges between 2003-03-10-3.3 (#76) and 2003-03-12-3.3 (#77). So it was caused by something that went on both the 3.3 branch and the mainline during though days.
The regression in PR 11697 was introduced or exposed by this patch: --- gcc/gcc/cp/ChangeLog --- 2003-03-11 Mark Mitchell <mark@codesourcery.com> PR c++/9336 * decl2.c (do_nonmember_using_decl): Do not call duplicate decls to merge old and new declarations. The regression hunt was done on i686-pc-linux-gnu using the submitter's test case with no special options.
Subject: Bug 11697 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-08-01 18:48:50 Modified files: gcc/cp : ChangeLog decl.c pt.c semantics.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: koenig2.C using6.C Log message: PR c++/11697 * decl.c (decls_match): Don't ignore the types of template classes. PR c++/11744 * pt.c (tsubst_copy_and_build): Refine Koenig lookup logic. PR c++/11697 * g++.dg/template/using6.C: New test. PR c++/11744 * g++.dg/template/koenig2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3579&r2=1.3580 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1106&r2=1.1107 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.748&r2=1.749 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.341&r2=1.342 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2944&r2=1.2945 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/koenig2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/using6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed in GCC 3.4.
This is a 3.3.1 regression with respect to 3.3 so reopening as 3.3.1 is not fixed yet.
Postponed until GCC 3.3.2; this is only an accepts-invalid.
Postponed until GCC 3.3.3.
Will not be fixed for 3.3.3.