[PATCH v2] Fix PR c++/25940

Jason Merrill jason@redhat.com
Sun Mar 2 19:22:00 GMT 2014


On 03/01/2014 08:13 PM, Patrick Palka wrote:
> On Sat, Mar 1, 2014 at 7:53 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
>> On Sat, 1 Mar 2014, Patrick Palka wrote:
>>
>>> +                     error_at (input_location,
>>> +                               "redefinition of %q+#D with C language
>>> linkage",
>>> +                               x);
>>> +                     inform (input_location,
>>> +                             "%q+#D previously defined here", previous);
>>
>>
>> It seems strange that both the new and the old declarations are at the same
>> location...
>
> Isn't input_location is a symbolic value standing for the location of
> the decl argument that's being printed?

No, it typically points to the last token parsed.  The reason your 
diagnostics have the location of the decl arguments is because of the 
'+' in the %q+#D format, which overrides the location given in the first 
argument.  So you could just as well use 0 instead of input_location, or 
use 'error' rather than error_at.

Jason



More information about the Gcc-patches mailing list