public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5116: operator resolution in template class
@ 2002-12-26  4:27 nathan
  0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-12-26  4:27 UTC (permalink / raw)
  To: binder, gcc-bugs, gcc-prs, hoessinger, nathan

Synopsis: operator resolution in template class

State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Thu Dec 26 04:27:25 2002
State-Changed-Why:
    2002-12-26  Nathan Sidwell  <nathan@codesourcery.com>
    
    	PR c++/5116, c++/764
    	* call.c (build_new_op): Make sure template class operands are
    	instantiated.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5116


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++/5116: operator resolution in template class
@ 2002-01-02  6:33 nathan
  0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-01-02  6:33 UTC (permalink / raw)
  To: binder, gcc-bugs, gcc-prs, hoessinger, nathan

Synopsis: operator resolution in template class

State-Changed-From-To: closed->analyzed
State-Changed-By: nathan
State-Changed-When: Wed Jan  2 06:33:13 2002
State-Changed-Why:
    oops that patch is incorrect.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5116


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++/5116: operator resolution in template class
@ 2002-01-02  3:38 nathan
  0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-01-02  3:38 UTC (permalink / raw)
  To: binder, gcc-bugs, gcc-prs, hoessinger, nathan

Synopsis: operator resolution in template class

State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Wed Jan  2 03:38:03 2002
State-Changed-Why:
    2002-01-02  Nathan Sidwell  <nathan@codesourcery.com>
    
    	PR c++/5116, c++/764
    	* call.c (build_new_op): Make sure template class operands are
    	instantiated. Simplify arglist construction.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5116


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++/5116: operator resolution in template class
@ 2001-12-31  7:16 nathan
  0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2001-12-31  7:16 UTC (permalink / raw)
  To: binder, gcc-bugs, gcc-prs, hoessinger, nathan, nobody

Synopsis: operator resolution in template class

Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Mon Dec 31 07:16:13 2001
Responsible-Changed-Why:
    patch in progress

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5116


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++/5116: operator resolution in template class
@ 2001-12-30 15:43 nathan
  0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2001-12-30 15:43 UTC (permalink / raw)
  To: binder, gcc-bugs, gcc-prs, hoessinger, nobody

Synopsis: operator resolution in template class

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sun Dec 30 15:43:51 2001
State-Changed-Why:
    confirmed

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5116


^ permalink raw reply	[flat|nested] 6+ messages in thread

* c++/5116: operator resolution in template class
@ 2001-12-14  7:56 binder
  0 siblings, 0 replies; 6+ messages in thread
From: binder @ 2001-12-14  7:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: hoessinger


>Number:         5116
>Category:       c++
>Synopsis:       operator resolution in template class
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 14 07:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     binder@iue.tuwien.ac.at
>Release:        3.0.2
>Organization:
>Environment:
g++ version:

Reading specs from /home/binder2/gcc3/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.0.2/specs
Configured with: ../gcc-3.0.2-src/configure --prefix=/home/binder2/gcc --enable-shared --enable-threads=posix
Thread model: posix
gcc version 3.0.2

OS: RedHat Linux 7.2, kernel 2.4.16


libc version:

GNU C Library stable release version 2.2.4, by Roland McGrath et al.
Copyright (C) 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 2.96 20000731 (Red Hat Linux 7.1 2.96-98).
Compiled on a Linux 2.4.9-0.17smp system on 2001-10-03.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        The C stubs add-on version 2.1.2.
        linuxthreads-0.9 by Xavier Leroy
        BIND-8.2.3-T5B
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        Glibc-2.0 compatibility add-on by Cristian Gafton 
        libthread_db work sponsored by Alpha Processor Inc
Report bugs using the `glibcbug' script to <bugs@gnu.org>.
>Description:
In the attached code g++ invokes operator bool() of the template class before the invokation of operator<<() takes place. 

This results in printing "1 in operator<<....." to stdout instead of printing "in operator<<..." twice.


#include <iostream>
using namespace std;

template <class T> struct Handle
{
	Handle(T* p)
	{}
	
	operator bool() const { return true; }
	
	friend ostream& operator<<(ostream& ostr, const Handle& r)
	{
		return ostr << "in operator<<(ostream&, const Handle&)";
	}
};

struct Buggy
{
	Buggy()
	{}
};

typedef Handle<Buggy>	Buggy_h;

struct BuggyCmp
{
	bool operator()(const Buggy_h& b1, const Buggy_h& b2) const
	{
		cout << b1 << " " << b2 << endl;
		return false;
	}
};


int main()
{
	BuggyCmp	cmp;

	cmp(new Buggy(), new Buggy());
}



>How-To-Repeat:
compile and run the attached program
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug1.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug1.cc"

CiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlIDxjbGFz
cyBUPiBzdHJ1Y3QgSGFuZGxlCnsKCUhhbmRsZShUKiBwKQoJe30KCQoJb3BlcmF0b3IgYm9vbCgp
IGNvbnN0IHsgcmV0dXJuIHRydWU7IH0KCQoJZnJpZW5kIG9zdHJlYW0mIG9wZXJhdG9yPDwob3N0
cmVhbSYgb3N0ciwgY29uc3QgSGFuZGxlJiByKQoJewoJCXJldHVybiBvc3RyIDw8ICJpbiBvcGVy
YXRvcjw8KG9zdHJlYW0mLCBjb25zdCBIYW5kbGUmKSI7Cgl9Cn07CgpzdHJ1Y3QgQnVnZ3kKewoJ
QnVnZ3koKQoJe30KfTsKCnR5cGVkZWYgSGFuZGxlPEJ1Z2d5PglCdWdneV9oOwoKc3RydWN0IEJ1
Z2d5Q21wCnsKCWJvb2wgb3BlcmF0b3IoKShjb25zdCBCdWdneV9oJiBiMSwgY29uc3QgQnVnZ3lf
aCYgYjIpIGNvbnN0Cgl7CgkJY291dCA8PCBiMSA8PCAiICIgPDwgYjIgPDwgZW5kbDsKCQlyZXR1
cm4gZmFsc2U7Cgl9Cn07CgoKaW50IG1haW4oKQp7CglCdWdneUNtcAljbXA7CgoJY21wKG5ldyBC
dWdneSgpLCBuZXcgQnVnZ3koKSk7Cn0KCg==


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-12-26 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-26  4:27 c++/5116: operator resolution in template class nathan
  -- strict thread matches above, loose matches on Subject: below --
2002-01-02  6:33 nathan
2002-01-02  3:38 nathan
2001-12-31  7:16 nathan
2001-12-30 15:43 nathan
2001-12-14  7:56 binder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).