Bug 20 - using declarations in templates
Summary: using declarations in templates
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 2.96
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: rejects-valid
: 276 (view as bug list)
Depends on:
Reported: 2000-03-03 01:26 UTC by martin
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host: i586-pc-linux-gnu
Target: i586-pc-linux-gnu
Build: i586-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description martin 2000-03-03 01:26:00 UTC
[Original Message-Id: <199812151612.RAA03367@jolan.ppro>]
a "using namespace" inside a template declaration doesn't work :/
(egcs-1.1b, didn't try it with a later version).

Example program:

namespace N {
  void func(void) {}

template<class T>
void foobar(T)
  using namespace ::N;

int main(void)
  return 0;

~/c++/tests>g++ -v namespace.cc
Reading specs from /usr/local/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
 /usr/local/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ namespace.cc /tmp/ccqfpULa.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /usr/local/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cc1plus /tmp/ccqfpULa.ii -quiet -dumpbase namespace.cc -version -o /tmp/ccygY4jd.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
namespace.cc: In function `void foobar<int>(int)':
namespace.cc:14:   instantiated from here
namespace.cc:9: `func' undeclared (first use this function)
namespace.cc:9: (Each undeclared identifier is reported only once
namespace.cc:9: for each function it appears in.)


System: Linux mira 2.3.48 #4 Sun Feb 27 23:26:02 CET 2000 i586 unknown
Architecture: i586

host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
Comment 1 Martin v. Loewis 2000-03-08 23:14:17 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed as a bug
Comment 2 Martin v. Loewis 2000-03-09 07:14:17 UTC
From: loewis@gcc.gnu.org
To: carlo@runaway.xs4all.nl, gcc-gnats@gcc.gnu.org,
  martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org
Subject: Re: c++/20
Date: 9 Mar 2000 07:14:17 -0000

 Old Synopsis: [not accepted] using declarations in templates
 New Synopsis: using declarations in templates
 State-Changed-From-To: open->analyzed
 State-Changed-By: loewis
 State-Changed-When: Wed Mar  8 23:14:17 2000
     Confirmed as a bug
Comment 3 Nathan Sidwell 2001-05-01 09:54:20 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: fixed via 2258
Comment 4 Nathan Sidwell 2001-05-01 13:54:20 UTC
From: nathan@gcc.gnu.org
To: carlo@runaway.xs4all.nl, sxking@uswest.net, ghuber@josquin.ucsd.edu,
  pedretti@roguewave.com, gcc-gnats@gcc.gnu.org,
  martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org
Subject: Re: c++/20
Date: 1 May 2001 13:54:20 -0000

 Synopsis: using declarations in templates
 State-Changed-From-To: analyzed->closed
 State-Changed-By: nathan
 State-Changed-When: Tue May  1 09:54:20 2001
     fixed via 2258