[patch] fix for c++/2416

Daniel Jacobowitz drow@false.org
Wed Feb 27 19:47:00 GMT 2008


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.

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?

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list