[cfe-dev] Can't use sizeof ( typeof ( <vla> ))
Friedman, Eli via cfe-dev
cfe-dev at lists.llvm.org
Thu Dec 1 10:39:34 PST 2016
On 12/1/2016 2:13 AM, Paulo Matos wrote:
>
> On 22/11/16 21:44, Friedman, Eli wrote:
>> The way it should work is that there are three calls to
>> TransformToPotentiallyEvaluated: the first time, we're calling on the
>> typeof, and it's unevaluated. The second time, we're calling it on the
>> sizeof(), and it's potentially evaluated. The third time is a recursive
>> call: in the process of transforming the sizeof(), we make a new
>> typeof() expression, and call TransformToPotentiallyEvaluated on that;
>> at that point, it should be potentially-evaluated. (Yes, this is
>> terribly inefficient, but it's a rare situation anyway.)
>>
> Apologies, only just managed to get back on this. I assume you're
> suggesting a solution, not how it's implemented.
This is what's already implemented for sizeof() on a expression. We
just don't do it properly for sizeof() on a type, I think. There are
two functions named Sema::CreateUnaryExprOrTypeTraitExpr; compare the
version which takes a type to the version which takes an expression.
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the cfe-dev
mailing list