Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] fix for c++/2416
Date: Tue, 04 Mar 2008 19:39:00 -0000	[thread overview]
Message-ID: <47CDA56C.6050804@qnx.com> (raw)
In-Reply-To: <47C78DD3.4080109@qnx.com>

Any thoughts on this?

Your feedback would be greatly appreciated.

Thanks,

Aleksandar Ristovski
QNX Software Systems


Aleksandar Ristovski wrote:
> Daniel Jacobowitz wrote:
>> On Thu, Feb 28, 2008 at 01:53:13PM -0500, Aleksandar Ristovski wrote:
>>> See revisited diff (attached). Also, please find attached the 
>>> testcase diff, I added check for reference casting. Do I need to 
>>> provide change log for tests too?
>>
>> The testsuite changes look fine but do need a changelog; that
>> goes in testsuite/ChangeLog.
> 
> 2008-02-28  Aleksandar Ristovski  <aristovski@qnx.com>
> 
>     * gdb.cp/casts.cc: Add class reference variables.
>     * gdb.cp/casts.exp: New test cases for up/down casting references.
> 
> 
>>
>> There's nothing wrong with casting a reference to a non-reference;
>> that coerces the reference.  Also you have to beware typedefs.
>>
>>       enum type_code code1, code2;
>>       code1 = TYPE_CODE (check_typedef (value_type (arg1)));
>>       code2 = TYPE_CODE (check_typedef (value_type (arg2)));
>>
>>       if (code1 == TYPE_CODE_REF && code2 == TYPE_CODE_REF)
>>         arg1 = value_cast_pointers (type, arg1);
>>       else if (code1 == TYPE_CODE_REF)
>>         error (_("Attempt to cast to reference type from non-reference 
>> type."));
>>       else
>>         arg1 = value_cast (type, arg1);
> 
> Allright, then how about this, yet newer and yet more revisited diff? I 
> removed changes to eval.c and let it simply call value_cast as it used 
> to. Now value_cast knows how to handle references.
> 
> 
> 2008-02-28  Aleksandar Ristovski <aristovski@qnx.com>
> 
>     * valops.c (value_cast_structs): New function. Cast related
>     STRUCT types up/down and return cast value. The body of this
>     function comes mostly from value_cast_pointers.
>     (value_cast_pointers): Code for actual cast STRUCT-STRUCT moved
>     to value_cast_structs. Now value_cast_pointers needs only create
>     appropriate reference after using value_cast_structs for actual
>     casting.
>     (value_cast): Handle references.
>     
> 


  reply	other threads:[~2008-03-04 19:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 18:43 Aleksandar Ristovski
2008-02-27 19:30 ` Michael Snyder
2008-02-27 19:36   ` Aleksandar Ristovski
2008-02-27 19:47 ` Daniel Jacobowitz
2008-02-27 20:00   ` Aleksandar Ristovski
2008-02-27 20:09     ` Daniel Jacobowitz
2008-02-27 21:26       ` Aleksandar Ristovski
2008-02-27 23:50         ` Daniel Jacobowitz
2008-02-28 19:12           ` Aleksandar Ristovski
2008-02-28 19:39             ` Daniel Jacobowitz
2008-02-29 10:10               ` Aleksandar Ristovski
2008-03-04 19:39                 ` Aleksandar Ristovski [this message]
2008-04-01 14:51                 ` Daniel Jacobowitz
2008-02-29  2:44             ` Michael Snyder
2008-03-31 19:01 Aleksandar Ristovski
2008-04-01 16:26 Aleksandar Ristovski
2008-04-01 17:06 ` Daniel Jacobowitz
2008-04-01 18:10 Aleksandar Ristovski
2008-04-01 18:52 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47CDA56C.6050804@qnx.com \
    --to=aristovski@qnx.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox