This is the mail archive of the
mailing list for the GCC project.
[Bug c++/29117] Copy constructor is called with "this == &rhs"
- From: "oschmidt at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Oct 2006 17:03:27 -0000
- Subject: [Bug c++/29117] Copy constructor is called with "this == &rhs"
- References: <email@example.com/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from oschmidt at gmx dot net 2006-10-12 17:03 -------
> You therefore initialize a variable with itself. This is
> a documented way to generate uninitialized variables and
> Here's the right combination of flags that warns (for f3() only):
Thank you for your answer, this is very interesting (but where is it
But still *very* dangerous, because the destructor of this unitialized object
is called and such the destructor is working with some random memory.
So a compiler warning for this makes really sense not only for f3() but also
BTW: I found that the IBM-C++ Compiler for MVS has similar behaviour, so it
really might be a feature and not a bug, althoug a very strange feature.