[PATCH] Check dynamic_cast is not used with -fno-rtti

David Blaikie dblaikie at gmail.com
Mon Jul 29 10:00:01 PDT 2013


The upcast/downcast tests might want to be codegen tests to ensure
that, not only do we not fail to compile it - but we compile it
correctly (not emitting any calls to RTTI stuff, etc).

On Mon, Jul 29, 2013 at 9:48 AM, Arnaud A. de Grandmaison
<arnaud.adegm at gmail.com> wrote:
> With the patch :)
>
> On 07/29/2013 06:47 PM, Arnaud A. de Grandmaison wrote:
>> On 07/29/2013 06:17 PM, Jean-Daniel Dupas wrote:
>>> Le 29 juil. 2013 à 17:52, Arnaud A. de Grandmaison <arnaud.adegm at gmail.com> a écrit :
>>>
>>>> Clang emits an error when typeid is used with -fno-rtti, but does not
>>>> perform a similar check for dynamic_cast.
>>>>
>>>> The attached patch implements the check.
>>>>
>>>> I have done it late in 'CastOperation::CheckDynamicCast' , as some
>>>> dynamic_cast can be resolved statically, and will thus require no
>>>> support from the runtime, but we may also want to be more paranoïd.
>>>>
>>>> Any thoughts ?
>>> If we want to support dynamic_cast without rtti when possible (as you do in your patch), you may add such case in the test to make sure clang accepts it.
>> Good point. I added a test for the 2 cases we accept (upcast, and cast
>> to same type).
>>
>>> -- Jean-Daniel
>>>
>>>
>>>
>>>
>>
>
>
> --
> Arnaud A. de Grandmaison
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list