c++: Tweak tsubst_qualified_id location.
authorMarek Polacek <polacek@redhat.com>
Tue, 10 Nov 2020 21:39:19 +0000 (16:39 -0500)
committerMarek Polacek <polacek@redhat.com>
Wed, 11 Nov 2020 17:36:52 +0000 (12:36 -0500)
commitd6e5745a9a88314e27f387b2277299076862af67
tree71ce4bec306b8303730e6a6c4257c3109ed045b2
parent2e8b368c3d33fd8ddafdd37f8e1b2ba45d1a122e
c++: Tweak tsubst_qualified_id location.

Retain the location when tsubstituting a qualified-id so that our
static_assert diagnostic can benefit.  Don't create useless location
wrappers for temporary variables.

gcc/ChangeLog:

PR c++/97518
* tree.c (maybe_wrap_with_location): Don't add a location
wrapper around an artificial and ignored decl.

gcc/cp/ChangeLog:

PR c++/97518
* pt.c (tsubst_qualified_id): Use EXPR_LOCATION of the qualified-id.
Use it to maybe_wrap_with_location the final expression.

gcc/testsuite/ChangeLog:

PR c++/97518
* g++.dg/diagnostic/static_assert3.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/diagnostic/static_assert3.C [new file with mode: 0644]
gcc/tree.c