public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41381] New: Default copy constructor and assignment operator ignored
@ 2009-09-16 18:01 mjdcc at cftp dot ist dot utl dot pt
2009-09-16 18:21 ` [Bug c++/41381] " paolo dot carlini at oracle dot com
0 siblings, 1 reply; 2+ messages in thread
From: mjdcc at cftp dot ist dot utl dot pt @ 2009-09-16 18:01 UTC (permalink / raw)
To: gcc-bugs
g++4.3.0 is wrongly eliding the copy constructor and the assignment of a
struct. Look at the following code:
#include <iostream>
#include <complex>
struct Complex {
std::complex<double> value;
};
const Complex one = { 1 };
int main() {
Complex z = one, w;
w = one;
std::cout << "one = " << one.value << std::endl;
std::cout << "z = " << z.value << std::endl;
std::cout << "w = " << w.value << std::endl;
}
It prints:
one = (1,0)
z = (0,0)
w = (0,0)
When the value is of type double instead of complex<double> the problem doesn't
occur. Also, this doesn't happen using the compiler switch
-fno-elide-constructors .
--
Summary: Default copy constructor and assignment operator ignored
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mjdcc at cftp dot ist dot utl dot pt
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41381
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/41381] Default copy constructor and assignment operator ignored
2009-09-16 18:01 [Bug c++/41381] New: Default copy constructor and assignment operator ignored mjdcc at cftp dot ist dot utl dot pt
@ 2009-09-16 18:21 ` paolo dot carlini at oracle dot com
0 siblings, 0 replies; 2+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-09-16 18:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-09-16 18:20 -------
Works for me with current compilers built out any active release branch.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Known to work| |4.3.4 4.4.1 4.5.0
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41381
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-16 18:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16 18:01 [Bug c++/41381] New: Default copy constructor and assignment operator ignored mjdcc at cftp dot ist dot utl dot pt
2009-09-16 18:21 ` [Bug c++/41381] " paolo dot carlini at oracle dot com
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).