Bug 55 - using-directives in templates
Summary: using-directives in templates
Status: CLOSED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 2.95.2
: P3 normal
Target Milestone: ---
Assignee: Martin v. Loewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-03-05 02:46 UTC by martin
Modified: 2005-07-23 22:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description martin 2000-03-05 02:46:01 UTC
 Original-Message-ID: <51C9F3C392D0D111A15600A0C99E64A9011E24B3@localhost>
 Date: Fri, 19 Nov 1999 18:15:36 -0700

 Hi,

 The following code does not compile, apparently due to a bug in the way
 function templates and namespaces are handled: class templates seem to work
 properly.

 Thanks,

 John

 ===========================
 John A. Pedretti, Rogue Wave Software, Inc.   
 (303) 545-3150     pedretti@roguewave.com  
 ===========================

 ---------------------------------------
 // foo.cc

 namespace xx {
     // declare function template inside namespace
     template <class T>
     void foo (T&) { }
 }

 // using namespace xx;          // compiles if the using declaration is
 moved to file scope

 // declare function template inside global namespace
 template <class T>
 void bar (T& t) {
     using namespace xx;
     foo (t);
 //    xx::foo (t);                       // compiles if foo() is explicitly
 qualified
 }

 template void bar<int> (const int&);  // instantiate bar<int>

 ----------------------------------------
 output of g++ -c -v foo.cc:


 Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
 gcc version 2.95.2 19991024 (release)
  /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNUC__=2
 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__
 -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux
 -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386
 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro
 -D__pentiumpro__ foo.cc /tmp/cc72F7M1.ii
 GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
 #include "..." search starts here:
 #include <...> search starts here:
  /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
  /usr/local/include

 /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/incl
 ude
  /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
  /usr/include
 End of search list.
 The following default directories have been omitted from the search path:
 End of omitted list.
  /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cc1plus /tmp/cc72F7M1.ii -quiet
 -dumpbase foo.cc -version -o /tmp/ccMoxa8S.s
 GNU C++ version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled by
 GNU C version 2.95.2 19991024 (release).
 foo.cc:19: template-id `bar<int>' for `bar(const int &)' does not match any
 template declaration
 foo.cc:19: confused by earlier errors, bailing out

 Compilation exited abnormally with code 1 at Fri Nov 19 20:16:49

Release:
2.95.2
Comment 1 Martin v. Loewis 2000-03-08 23:34:48 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed as a bug
Comment 2 Martin v. Loewis 2000-03-09 07:34:48 UTC
From: loewis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org, pedretti@roguewave.com
Cc:  
Subject: Re: c++/55
Date: 9 Mar 2000 07:34:48 -0000

 Old Synopsis: [not accepted] using-directives in templates
 New Synopsis: using-directives in templates
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: loewis
 State-Changed-When: Wed Mar  8 23:34:48 2000
 State-Changed-Why:
     Confirmed as a bug  
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=55&database=gcc
Comment 3 Martin v. Loewis 2000-06-27 14:41:32 UTC
*** This bug has been marked as a duplicate of 20 ***
Comment 4 Martin v. Loewis 2000-06-27 21:41:32 UTC
From: loewis@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org, pedretti@roguewave.com
Cc:  
Subject: Re: c++/55
Date: 27 Jun 2000 21:41:32 -0000

 Synopsis: using-directives in templates
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: loewis
 State-Changed-When: Tue Jun 27 14:41:32 2000
 State-Changed-Why:
     Duplicate of PR 20; submitter added to CC list of PR 20
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=55&database=gcc
Comment 5 Nathanael C. Nerode 2003-05-22 17:31:28 UTC
definite duplicate