Bug 32 - templated friend ostream & operator <<
Summary: templated friend ostream & operator <<
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 2.95.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2000-03-04 13:16 UTC by martin
Modified: 2003-07-25 17:33 UTC (History)
3 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-04 13:16:00 UTC
 Date: Wed, 11 Aug 1999 11:54:39 +0400 (MSD)
 Original-Message-ID: <Pine.LNX.3.96.990811115248.4976D-100000@gams.ihep.su>

 Dear gcc developers!

 The code (see below) compiles fine with egcs-1.1.2 and does not compile
 with gcc-2.95.

 I get error message:
 bug1.c: In instantiation of `A<int,6>':
 bug1.c:15:   instantiated from here
 bug1.c:8: template-id `operator <<<>' for `operator <<(ostream &, const
 A<int,6> &)' does not match any template declaration
 bug1.c: In function `int main()':
 bug1.c:16: no match for `_IO_ostream_withassign & << A<int,6> &'
 ... more lines ...


 With best wishes,
 Alexander Zvyagin.


 // --- CUT HERE ---
 #include <iostream>

 template <class T,T n> class A;

 template <class T,T n> ostream &operator << (ostream &o,const A<T,n> &a);

 template <class T,T n>
 class A { friend ostream &operator << <> (ostream &o,const A<T,n> &a); };

 template <class T,T n> ostream &operator << (ostream &o,const A<T,n> &a)
 { return o << __PRETTY_FUNCTION__ << endl; }

 main(void)
 {
   A<int,6> a;
   cout << a << endl;
 }
 // ---- CUT HERE ------

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

 Synopsis: templated friend ostream & operator <<
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: loewis
 State-Changed-When: Wed Mar  8 23:21:32 2000
 State-Changed-Why:
     Confirmed as a bug  
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=32&database=gcc
Comment 3 Nathan Sidwell 2000-09-07 05:03:31 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: appears fixed in CVS 20000907
Comment 4 Nathan Sidwell 2000-09-07 12:03:31 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de,
  nobody@gcc.gnu.org, zvyagin@gams.ihep.su
Cc:  
Subject: Re: c++/32
Date: 7 Sep 2000 12:03:31 -0000

 Synopsis: templated friend ostream & operator <<
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: nathan
 State-Changed-When: Thu Sep  7 05:03:31 2000
 State-Changed-Why:
     appears fixed in CVS 20000907
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=32&database=gcc