This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18113] New: compiler allows 2 copy constructors
- From: "profvonsully at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2004 16:48:59 -0000
- Subject: [Bug c++/18113] New: compiler allows 2 copy constructors
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The bug is simple :
lets say :
"
class TObject;
typedef TObject& rObject;
class TObject
{
public:
TObject(){}
TObject(const TObject&);
TObject(const rObject);
};
TObject::TObject(const TObject&)
{
char*s;
s="constructor 1";
}
TObject::TObject(const rObject)
{
char*s;
s="constructor 2";
}
"
In da function:
"
TObject F()
{
TObject AnObject;
TObject anotherObject=AnObject;//constructor 2 !!!
return AnObject;
}
" constructor 2 will be called!
--
Summary: compiler allows 2 copy constructors
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: profvonsully at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386
GCC host triplet: i386
GCC target triplet: i386
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18113