[Bug debug/33537] New: [4.0/4.1/4.2/4.3 regression] C++ arguments passed by invisible reference have wrong type
drow at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 15:18:00 GMT 2007
Compile the code below using g++ -g, load the object into gdb, and 'ptype foo'.
You will see that the type of foo is 'int (Obj &)'. If this function is
called from GDB, and the called function modifies its argument, it will end up
modifying the original copy. It's supposed to get a temporary copy.
This changed sometime between g++ 3.3 and g++ 4.0.
class Obj {
public:
Obj ();
Obj (const Obj &);
~Obj ();
int var[2];
};
int foo (Obj arg)
{
return arg.var[0] + arg.var[1];
}
int main() { return 0; }
Obj::Obj ()
{
var[0] = 1;
var[1] = 2;
}
Obj::Obj (const Obj &obj)
{
var[0] = obj.var[0];
var[1] = obj.var[1];
}
Obj::~Obj ()
{
}
--
Summary: [4.0/4.1/4.2/4.3 regression] C++ arguments passed by
invisible reference have wrong type
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: drow at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33537
More information about the Gcc-bugs
mailing list