public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3615: unneccessary temporary instance created during function call
@ 2001-11-15 12:38 mmitchel
0 siblings, 0 replies; 4+ messages in thread
From: mmitchel @ 2001-11-15 12:38 UTC (permalink / raw)
To: gdr; +Cc: gcc-prs
The following reply was made to PR c++/3615; it has been noted by GNATS.
From: mmitchel@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
gdr@gcc.gnu.org, niemayer@isg.de
Cc:
Subject: Re: c++/3615: unneccessary temporary instance created during function call
Date: 20 Nov 2001 09:06:22 -0000
Synopsis: unneccessary temporary instance created during function call
State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Tue Nov 20 01:06:21 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3615&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3615: unneccessary temporary instance created during function call
@ 2001-11-15 12:26 mmitchel
0 siblings, 0 replies; 4+ messages in thread
From: mmitchel @ 2001-11-15 12:26 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, gdr, niemayer
Synopsis: unneccessary temporary instance created during function call
State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Tue Nov 20 01:06:21 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=3615&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3615: unneccessary temporary instance created during function call
@ 2001-08-12 4:00 gdr
0 siblings, 0 replies; 4+ messages in thread
From: gdr @ 2001-08-12 4:00 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gdr, niemayer, nobody
Synopsis: unneccessary temporary instance created during function call
Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-By: gdr
Responsible-Changed-When: Sun Aug 12 04:00:33 2001
Responsible-Changed-Why:
See below.
State-Changed-From-To: open->analyzed
State-Changed-By: gdr
State-Changed-When: Sun Aug 12 04:00:33 2001
State-Changed-Why:
Confirmed as an horrible bug. A regression over gcc-2.95.2.
See also PR #3471.
-- Gaby
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3615&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* c++/3615: unneccessary temporary instance created during function call
@ 2001-07-09 3:56 niemayer
0 siblings, 0 replies; 4+ messages in thread
From: niemayer @ 2001-07-09 3:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 3615
>Category: c++
>Synopsis: unneccessary temporary instance created during function call
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 09 03:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Peter Niemayer
>Release: gcc-3.0
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
When calling a function that takes a reference to a base
class "base" with an argument that is an instance of a
class that can be casted to a "class foo &" (where foo
is derived from "base"), gcc3 tries to create a temporary
"foo" instance without any reason and failing if copying
of "foo" isn't allowed.
>How-To-Repeat:
compiling the following small code example with gcc2 works
fine, with gcc-3.0 it results in the error:
bug.cxx: In function `void bug()':
bug.cxx:26: `foo::foo(const foo&)' is private
bug.cxx:47: within this context
bug.cxx:47: initializing temporary from result of `Ptr<T>::operator T&()
[with T = foo]'
bug.cxx:38: in passing argument 1 of `void func2(base&)'
---------- code sample -----------
template <class T>
class Ptr {
protected:
T * ptr;
public:
Ptr(void) : ptr(0) { };
Ptr(T * p) : ptr(p) { };
~Ptr(void) { delete ptr; }
operator T & () { return *ptr; }
};
class base {
public:
base(void) { }
~base(void) { }
};
class foo : public base {
private:
foo(const foo & rv); // does not exist - no copy allowed!
public:
foo(void) { }
~foo(void) { }
};
void func(foo & f) {
// ...
}
void func2(base & b) {
// ...
}
void bug(void) {
Ptr<foo> f = new foo;
func(f); // works as expected with gcc2 and gcc3
func2(f); // works with gcc2, creates an unneccessary
// temporary instance with gcc-3.0
}
---------- code sample end ------------
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-11-20 9:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-15 12:38 c++/3615: unneccessary temporary instance created during function call mmitchel
-- strict thread matches above, loose matches on Subject: below --
2001-11-15 12:26 mmitchel
2001-08-12 4:00 gdr
2001-07-09 3:56 niemayer
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).