aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-03-12 14:57:56 -0500
committerPatrick Palka <ppalka@redhat.com>2022-03-12 14:57:56 -0500
commit28750ac2765e808aa4f45a73c630e53575834efd (patch)
tree16a6f9a9b38211da1405e4e388b76c48f7bc4f81 /gcc/cp
parent80fcc4b6afee72443bef551064826b3b4b6785e6 (diff)
downloadgcc-28750ac2765e808aa4f45a73c630e53575834efd.zip
gcc-28750ac2765e808aa4f45a73c630e53575834efd.tar.gz
gcc-28750ac2765e808aa4f45a73c630e53575834efd.tar.bz2
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.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/semantics.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index da270e8..d5565eb 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12197,7 +12197,7 @@ finish_unary_fold_expr (tree expr, int op, tree_code dir)
/* Build the fold expression. */
tree code = build_int_cstu (integer_type_node, abs (op));
- tree fold = build_min_nt_loc (UNKNOWN_LOCATION, dir, code, pack);
+ tree fold = build_min_nt_loc (input_location, dir, code, pack);
FOLD_EXPR_MODIFY_P (fold) = (op < 0);
TREE_TYPE (fold) = build_dependent_operator_type (NULL_TREE,
FOLD_EXPR_OP (fold),
@@ -12226,7 +12226,7 @@ finish_binary_fold_expr (tree pack, tree init, int op, tree_code dir)
{
pack = make_pack_expansion (pack);
tree code = build_int_cstu (integer_type_node, abs (op));
- tree fold = build_min_nt_loc (UNKNOWN_LOCATION, dir, code, pack, init);
+ tree fold = build_min_nt_loc (input_location, dir, code, pack, init);
FOLD_EXPR_MODIFY_P (fold) = (op < 0);
TREE_TYPE (fold) = build_dependent_operator_type (NULL_TREE,
FOLD_EXPR_OP (fold),