[patch] fix for c++/2416
Aleksandar Ristovski
aristovski@qnx.com
Wed Feb 27 20:00:00 GMT 2008
Daniel Jacobowitz wrote:
> On Wed, Feb 27, 2008 at 01:03:26PM -0500, Aleksandar Ristovski wrote:
>> Hello,
>>
>> As described in the bug report 2416, the problem is with casting to a
>> reference. The attached patch should fix this.
>
> /* You can't cast to a reference type. See value_cast_pointers
> instead. */
> gdb_assert (code1 != TYPE_CODE_REF);
>
> Is casting to a reference type useful, or should we have issued an
> error instead? C++ does not permit this.
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();
}
>
> 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.
More information about the Gdb-patches
mailing list