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

Paulo Matos via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 22 00:18:52 PST 2016



On 21/11/16 19:23, Friedman, Eli wrote:
>> Unfortunately the previous context is a sizeof which is not evaluated
>> and therefore leaves the typeof as unevaluated, hence the bug.
>>
> git grep shows that TransformToPotentiallyEvaluated has three callers;
> one for typeof, one for sizeof, and one for typeid.
> 

That's correct but that's not the problem. It works ok for sizeof (vla)
and for typeof (vla) but not for sizeof (typeof (vla)). Note that
TransformToPotentiallyEvaluated is called for typeof (the inner
expression) and this function only actually does the transformation is
the sizeof (...) context is marked as PotentiallyEvaluated, which is not
in trunk.

I submitted a patch for review that fixes the issue (but causes others)
that mark the sizeof context as PotentiallyEvaluated, however this needs
changing.

If you have any suggestions on how to go about fixing this, I am all ears.

Kind regards,
-- 
Paulo Matos



More information about the cfe-dev mailing list