c++/3136: Misleading error message / Bug?
rodrigc@gcc.gnu.org
rodrigc@gcc.gnu.org
Fri Jun 15 16:36:00 GMT 2001
Synopsis: Misleading error message / Bug?
State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Fri Jun 15 16:35:57 2001
State-Changed-Why:
gcc is not in error. There is a bug in your code.
The error message may be misleading though.
On line 74, of your test case:
return self.getMe();
The compiler creates a temporary variable
to store the result of getMe(), since self
is not a const reference.
What is happening is that on line 74:
return self.getMe();
When you return this temporary value, you are passing
it to a copy constructor which takes derived_t&
(without a const) as value. This is not allowed in C++.
Your options are to make self a const parameter to the
whatHappensHere() function.
This is similar to a bug report described here:
http://gcc.gnu.org/ml/gcc/2001-06/msg00765.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3136&database=gcc
More information about the Gcc-bugs
mailing list