C++ PATCH for c++/91740 - ICE with constexpr call and ?: in ARRAY_REF

Paolo Carlini paolo.carlini@oracle.com
Thu Sep 12 09:08:00 GMT 2019


Hi again,

On 12/09/19 11:03, Paolo Carlini wrote:
> Hi,
>
> On 11/09/19 23:15, Marek Polacek wrote:
>> --- gcc/cp/pt.c
>> +++ gcc/cp/pt.c
>> @@ -26709,7 +26709,7 @@ build_non_dependent_expr (tree expr)
>>     if (TREE_CODE (expr) == COND_EXPR)
>>       return build3 (COND_EXPR,
>>              TREE_TYPE (expr),
>> -           TREE_OPERAND (expr, 0),
>> +           build_non_dependent_expr (TREE_OPERAND (expr, 0)),
>>              (TREE_OPERAND (expr, 1)
>>               ? build_non_dependent_expr (TREE_OPERAND (expr, 1))
>>               : build_non_dependent_expr (TREE_OPERAND (expr, 0))),
>
> Looks like we would end up unnecessarily calling 
> build_non_dependent_expr three times instead of two: probably is very 
> cheap, probably the code is cleaner this way but I'm a little annoyed 
> at this anyway, for the record ;)

Sorry, I misread the code: normally TREE_OPERAND (expr, 1) isn't 
NULL_TREE thus we are fine.

Paolo.



More information about the Gcc-patches mailing list