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