[cfe-dev] Can't use sizeof ( typeof ( <vla> ))

Paulo Matos via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 17 10:06:11 PST 2016



On 17/11/16 19:00, Friedman, Eli wrote:
> On 11/17/2016 7:02 AM, Paulo Matos via cfe-dev wrote:
>> The problem with this rationale is that it's not true in this case since
>> you need to evaluate typeof (a), which can't be evaluated at compile
>> time. Is it true that to fix this issue, we need to rethink how sizeof
>> are evaluated?
> 
> sizeof() and typeof() with an operand of VLA type are already
> special-cased; see Sema::TransformToPotentiallyEvaluated.
> 

In that case there's a bug in that special casing, since compiler is
crashing with the example I posted. I will try to find out why. Was not
aware of Sema::TransformToPotentiallyEvaluated.

> -Eli
> 

-- 
Paulo Matos



More information about the cfe-dev mailing list