[PATCH] Fix PR c++/26698: g++ accepts const-incorrect code due to conversion function

Simon Martin simartin@users.sourceforge.net
Fri Oct 12 18:48:00 GMT 2007


Hi Mark.

> You can simplify this condition a bit.  If you use
> same_type_ignoring_top_level_qualifiers_p, it will automatically do the
> TYPE_MAIN_VARIANT bit for you.  And, so will DERIVED_FROM_P, so:
> 
>   tree to_non_ref = non_reference (totype);
>   if (same_type_ignoring_top_level_qualifiers_p (to_non_ref, fromtype)
>       || (CLASS_TYPE_P (to_non_ref) && CLASS_TYPE_P (fromtype)
>           && DERIVED_FROM_P (to_non_ref, fromtype))
> 
> should work.  OK with that change.
It works indeed. I attach the updated patch, that I've successfully
regtested on i386-apple-darwin8.10.1, and that I will commit into trunk
and the 4.2 branch.

Best regards,
Simon




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_26698_2
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071012/2dc62951/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr26698_2.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071012/2dc62951/attachment-0001.ksh>


More information about the Gcc-patches mailing list