This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] fix for c++/2416


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]