* G++ bug in 971215: Extra temporary for method arguments
@ 1997-12-26 14:14 chip
0 siblings, 0 replies; only message in thread
From: chip @ 1997-12-26 14:14 UTC (permalink / raw)
To: egcs
G++ in egcs-971217 creates an extra temporary for member function
arguments that are declared as a base value but are given a derived
value instead. What's really interesting is that this extra temporary
doesn't show up on regular functions calls, but only on member
function calls....
I'd look into it, but G++ is big and I haven't been into its guts in
years.... Any clues, oh G++ hackers?
Here's a test program that demonstrates the extra temporary:
-----------------------------------------------------------------------
#include <iostream>
class B {
public:
B() { cout << "B::B()" << endl; }
B(const B&) { cout << "B::B(const B&)" << endl; }
~B() { cout << "B::~B()" << endl; }
};
class D : public B {
public:
D() { cout << "D::D()" << endl; }
D(const D &d) : B(d) { cout << "D::D(const D&)" << endl; }
~D() { cout << "D::~D()" << endl; }
};
class Foo {
public:
void foo(B b) {}
};
int
main(int, char **)
{
D d;
Foo *f = new Foo;
f->foo(d);
}
-----------------------------------------------------------------------
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"All you need is a toxic landfill /
A cycle and a sidecar and an urge to kill" // MST3K
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1997-12-26 14:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-26 14:14 G++ bug in 971215: Extra temporary for method arguments chip
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).