From paul@kauai.atinc.com  Tue Jan 24 13:22:41 1995
Received: from kauai.atinc.com ([198.138.38.12]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id NAA12093 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Jan 1995 13:22:20 -0800
Received: (from paul@localhost) by kauai.atinc.com (8.6.9/8.6.9) id QAA20267; Tue, 24 Jan 1995 16:20:28 GMT
Message-Id: <199501241620.QAA20267@kauai.atinc.com>
Date: Tue, 24 Jan 1995 16:20:28 GMT
From: paul@kryten.atinc.com
Reply-To: paul@kryten.atinc.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: gnu gcc version 2.6.2
X-Send-Pr-Version: 3.2

>Number:         183
>Category:       gnu
>Synopsis:       can't resolve "operator <<" overload
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 24 13:30:04 1995
>Closed-Date:    Sun Feb 9 16:26:56 PST 1997
>Last-Modified:  Sun Feb  9 16:28:42 PST 1997
>Originator:     Paul Berner Ph.D.
>Release:        FreeBSD 2.0-RELEASE i386
>Organization:
Analysis & Technology, Inc., Arlington VA
>Environment:

FreeBSD kauai.atinc.com 2.0-RELEASE FreeBSD 2.0-RELEASE #0: Thu Jan 19 11:40:01
1995     jmb@kauai.atinc.com:/usr/src/sys/compile/KAUAI  i386

gcc version 2.6.2
and

gcc version 2.6.3 (FreeBSD 2.1-STABLE #0: Wed Oct 18 03:41:51 PDT 1995     davidg@freefall.freebsd.org:/c/local/sys/compile/FREEFALL)


>Description:

	Can not resolve X& operator<<( X, int)
	when X is a child of ostream and the operator is explicitly defined.

>How-To-Repeat:
compile:

#include <iostream.h>

class Errors : public ostream {
};
Errors  bug;

Errors& operator << (Errors& d, int t)
       {
            return d;
       }

int main()
{
	bug << 5;
	return 0;
}

/*****
gcc version 2.6.2

gcc -c -Wall this_file produces:

bug.cc: In function `int main()':
bug.cc:14: call of overloaded method `operator <<(int)' is ambiguous
/usr/include/g++/iostream.h:95: candidates are: ostream::operator <<(long double)
/usr/include/g++/iostream.h:71:                 ostream::operator <<(char)
/usr/include/g++/iostream.h:72:                 ostream::operator <<(unsigned char)
/usr/include/g++/iostream.h:73:                 ostream::operator <<(signed char)
/usr/include/g++/iostream.h:93:                 ostream::operator <<(double)
/usr/include/g++/iostream.h:94:                 ostream::operator <<(float)
/usr/include/g++/iostream.h:81:                 ostream::operator <<(unsigned int)
/usr/include/g++/iostream.h:82:                 ostream::operator <<(long int)
/usr/include/g++/iostream.h:83:                 ostream::operator <<(long unsigned int)
/usr/include/g++/iostream.h:85:                 ostream::operator <<(long long int)
/usr/include/g++/iostream.h:86:                 ostream::operator <<(long long unsigned int)
/usr/include/g++/iostream.h:88:                 ostream::operator <<(short int)
/usr/include/g++/iostream.h:89:                 ostream::operator <<(short unsigned int)
/usr/include/g++/iostream.h:91:                 ostream::operator <<(bool)
/usr/include/g++/iostream.h:80:                 ostream::operator <<(int)
bug.cc:8:                 operator <<(Errors &, int)
*****/
>Fix:
	
unknown

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bde 
Responsible-Changed-By: scrappy 
Responsible-Changed-When: Mon May 27 14:21:13 PDT 1996 
Responsible-Changed-Why:  
he always seems to know alot about this sort of stuff...and its 
getting stale in the closet after over a year... 
Responsible-Changed-From-To: bde->peter 
Responsible-Changed-By: bde 
Responsible-Changed-When: Sun Oct 13 11:28:41 PDT 1996 
Responsible-Changed-Why:  
Peter seems to know a lot more about C++ than me :-). 
The example seems to work in -current with gcc-2.7.2.1 
but not in 2.1.5 with gcc-2.6.3. 
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Sun Feb 9 16:26:56 PST 1997 
State-Changed-Why:  
The sample program compiles under -current, and due to the 
PR's age, it is unlikely that anything will ever be 
done with past releases. 


Responsible-Changed-From-To: peter->freebsd-bugs 
Responsible-Changed-By: mpp 
Responsible-Changed-When: Sun Feb 9 16:26:56 PST 1997 
Responsible-Changed-Why:  
Moved back to freebsd-bugs for mailing list notification 
>Unformatted:


