Hi,
> 
> I cannot answer because I don't know what are the defaults. What does
> build_min_nt use by default?

UNKNOWN_LOCATION. I think this answers most of your concerns.

> -    expr = build_new_op (loc, code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE,
> +    expr = build_new_op (LOC_OR_HERE (loc), code, LOOKUP_NORMAL,
> +             arg1, arg2, NULL_TREE,
>             overload, complain);
> 
> This doesn't seem correct to me because of the reasons Jason gave. If
> loc is unknown, you are changing the behaviour.

If loc is UNKNOWN I'm passing down an input_location which seems a definite 
improvement to me in the light of your last message, given that the called 
function may immediately error out and try to use that location in the 
error_at. But I'm not going to insist.

> 
> -  expr = build_new_op (input_location, ARRAY_REF, LOOKUP_NORMAL, arg1,
> +  expr = build_new_op (LOC_OR_HERE (loc), ARRAY_REF, LOOKUP_NORMAL, arg1,
>               arg2, NULL_TREE, /*overload=*/NULL, complain);
> 
> This (and similar ones that change input_location to LOC_OR_HERE) seem
> correct to me because either you have a valid location or things stay
> as before. Of course, whether the valid location is more correct than
> input_location depends on the context. Which is the really tricky
> part, specially because during the transition neither option may be
> optimal.

Ok.

Thanks!
Paolo

Reply via email to