c++: give fold expressions a location
authorPatrick Palka <ppalka@redhat.com>
Sat, 12 Mar 2022 19:57:56 +0000 (14:57 -0500)
committerPatrick Palka <ppalka@redhat.com>
Sat, 12 Mar 2022 19:57:56 +0000 (14:57 -0500)
commit28750ac2765e808aa4f45a73c630e53575834efd
tree16a6f9a9b38211da1405e4e388b76c48f7bc4f81
parent80fcc4b6afee72443bef551064826b3b4b6785e6
c++: give fold expressions a location

This improves diagnostic quality for unsatisfied atomic constraints
that consist of a fold expression, e.g. in concepts/diagnostic3.C
the "evaluated to false" diagnostic now points to the expression:

  .../diagnostic3.C:10:22: note: the expression ‘(foo<Ts> && ...) [with Ts = {int, char}]’ evaluated to ‘false’
     10 | requires (foo<Ts> && ...)
        |          ~~~~~~~~~~~~^~~~

gcc/cp/ChangeLog:

* semantics.cc (finish_unary_fold_expr): Use input_location
instead of UNKNOWN_LOCATION.
(finish_binary_fold_expr): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/diagnostic3.C: Adjusted expected location of
"evaluated to false" diagnostics.
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/concepts/diagnostic3.C