[PATCH v2] Capture source location of dtors (PR c++/89390)

Jason Merrill jason@redhat.com
Thu Feb 21 08:14:00 GMT 2019


On 2/20/19 4:33 PM, David Malcolm wrote:
> On Tue, 2019-02-19 at 20:37 +0100, Jakub Jelinek wrote:
>> On Tue, Feb 19, 2019 at 02:44:55PM -0500, David Malcolm wrote:
>>> How about something like this? (on top of Jakub's patch)
>>
>> I had following queued for regtest, so if you want to go for the
>> make_location ^~, you should change more spots.
>>
>>> pr89390.C: In function 'void foo()':
>>> pr89390.C:9:6: error: '~A' is not a member of 'A'
>>>      9 |   A::~A ();    // { dg-error "6: '~A' is not a member of
>>> 'A'" }
>>>        |      ^~
>>> pr89390.C: In function 'void test_2()':
>>> pr89390.C:17:10: error: '~ns::P' is not a member of 'ns::P'
>>>     17 |   ns::P::~P ();    // { dg-error "10: '~ns::P' is not a
>>> member of 'ns::P'" }
>>>        |          ^~
>>>
>>> (Presumably gcc 10 material at this point; not yet bootstrapped).
>>
>> I wouldn't say so, it actually is even a regression:
>> $ /usr/src/gcc-6/obj/gcc/cc1plus -quiet pr89390.C
>> pr89390.C: In function ‘void foo()’:
>> pr89390.C:9:3: error: ‘~A’ is not a member of ‘A’
>>     A::~A (); // { dg-error "'~A' is not a member of 'A'" }
>>     ^
>>
>> $ /usr/src/gcc-7/obj/gcc/cc1plus -quiet pr89390.C
>> In function ‘void foo()’:
>> cc1plus: error: ‘~A’ is not a member of ‘A’
>>
>> Feel free to take this over though.
>>
>> 2019-02-19  Jakub Jelinek  <jakub@redhat.com>
>>
>> 	PR c++/89390
>> 	* parser.c (cp_parser_unqualified_id): For BIT_NOT_EXPR
>> remember
>> 	location of the ~ token and use it to build cp_expr.
>>
>> 	* g++.dg/diagnostic/pr89390.C (foo): Expect diagnostics at the
>> right
>> 	line.
> 
> Thanks.
> 
> Here's an updated version of the patch which use make_location, and
> merges in the changes from yours, and uses the loc in some other places
> (adding test coverage for them); hope that's not stretching things
> too far.
> 
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> 
> OK for trunk?

OK.

Jason



More information about the Gcc-patches mailing list