[patch] fix for c++/2416
Daniel Jacobowitz
drow@false.org
Wed Feb 27 20:09:00 GMT 2008
On Wed, Feb 27, 2008 at 02:48:20PM -0500, Aleksandar Ristovski wrote:
> Not sure what you mean by "C++ does not permit this"...
>
> This is valid:
>
> void testCast1 (IP::base & arg) {
> IP::derived &ader = (IP::derived &)arg;
> cout << "Test the casting\n";
> ader.foo();
> }
Humph. You're right, of course. When I added that assertion I
must not have thought about this case. I think you've put the fix
in the right place; the reference behavior is a bit startling, so
we would like to know if it comes up anywhere else in GDB besides from
an expression.
For expressions, casting one reference to another is OK; casting a
reference to a non-reference is also fine. Only non-reference to
reference is trouble.
>> The new error is incorrect, which does suggest some missing tests.
>> You can cast from a reference type; value_cast follows references,
>> so an int is just like an int &.
>>
>> Like Michael, I don't understand the value.c changes. Could you
>> explain them?
>>
> I replied to that.
What about the changes to coerce_array?
--
Daniel Jacobowitz
CodeSourcery
More information about the Gdb-patches
mailing list