Hi,

> On 16 May 2012 19:53, Paolo Carlini <pcarl...@gmail.com> wrote:
>>> -    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.
>> 
> 
> But then, this should have happened before, no? Or do we get
> UNKNOWN_LOCATION now but not before? That would indicate something has
> changed in an upper level that is not quite right. The point is that
> some things may naturally have UNKNOWN_LOCATION, however, such things
> should never be used in diagnostics. That indicates a bug. So, if the
> caller is passing down loc == UNKNOWN_LOCATION here and this new
> operation is never artificial, then the caller is wrongly passing down
> UNKNOWN_LOCATION.
> 
> In this particular case, you may have just uncovered a latent bug, and
> use the LOC_OR_HERE trick to defer fixing it for later. That seems OK
> to me, but then you should add a FIXME for such case, saying "This
> should be just LOC but something is passing down UNKNOWN_LOCATION and
> this breaks so and so"

To clarify: I didn't do that out of "empirical necessity", because not doing it 
caused regression, or I had a new testcase which required it. I did it for 
consistency with all the other build_x_* functions, because I gathered that we 
never ever want to pass an UNKNOWN_LOCATION to a diagnostic function. But 
really I'm not going to insist, I can as well only in this build_x_* not use 
the LOC_OR_HERE trick, just, hey, let's agree on something which is a small but 
clear improvement and move to the next step in this (long, I'm afraid) path.

Paolo

Reply via email to