------- Comment #4 from mmitchel at gcc dot gnu dot org  2006-07-20 03:59 
-------
I do not believe this is a bug.  The problematic conversion is:

    SdOptionsPrint &rOldUnconst = (SdOptionsPrint&)(rOther);

Here, rOther is declared as:

  const SdOptionsPrintItem &rOther

and SdOptionsPrintItem is derived from SdOptionsPrint.

In the current WP, the first option for static_cast is casting an lvalue of
type cv1 B to cv2 D, where D is derived from B.  This case does not apply; we
are casting from derived to base, not base to derived.  The second option is a
converion as if:

  SdOptionsPrint &t(rOther);

However, that conversion is not valid, as it casts aways const-ness. 
(Therefore, the reference cannot be bound directly to the object referred to by
rOther, and since the reference is not to a const non-volatile type, we are not
allowed to create a temporary.)  There are then several other options, none of
which apply.

Therefore, this case is in fact a reinterpret_cast.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28357

Reply via email to