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

Arnaud A. de Grandmaison arnaud.adegm at gmail.com
Tue Jul 30 13:49:43 PDT 2013


Ping ?

On Monday 29 July 2013 23:06:25 Arnaud Allard de Grandmaison wrote:


On Mon, Jul 29, 2013 at 7:00 PM, David Blaikie <dblaikie at gmail.com[1]> wrote:


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




Thanks David !


The test is now a codegen test, checking there is no call to __dynamic_cast --- and 
no diagnostics.
 
Cheers,
--
Arnaud


 
Arnaud A. de GrandmaisonArnaud A. de GrandmaisonArnaud A. de 
GrandmaisonArnaud A. de GrandmaisonOn Mon, Jul 29, 2013 at 9:48 AM, 
<arnaud.adegm at gmail.com[2]> wrote:> With the patch :)>> On 07/29/2013 06:47 
PM,  wrote:>> On 07/29/2013 06:17 PM, Jean-Daniel Dupas wrote:>>> Le 29 juil. 
2013 à 17:52,  <_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>>>>>>>>>>>>>>>>> --> >>


> _______________________________________________> cfe-commits mailing list> 
cfe-commits at cs.uiuc.edu[3]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits[4]





-- 
Arnaud A. de Grandmaison

--------
[1] mailto:dblaikie at gmail.com
[2] mailto:arnaud.adegm at gmail.com
[3] mailto:cfe-commits at cs.uiuc.edu
[4] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130730/0c28f440/attachment.html>


More information about the cfe-commits mailing list