aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-11-14 23:18:19 -0500
committerJason Merrill <jason@redhat.com>2021-11-15 02:52:36 -0500
commit2317082c151e5580e0bfe5fcfbd0e9d0172446c9 (patch)
tree69059807d9ebc4345c55559282dec9b7519db46f /gcc/cp/call.c
parent37326651b439bac55d96fb5a43f4daf25e401eda (diff)
downloadgcc-2317082c151e5580e0bfe5fcfbd0e9d0172446c9.zip
gcc-2317082c151e5580e0bfe5fcfbd0e9d0172446c9.tar.gz
gcc-2317082c151e5580e0bfe5fcfbd0e9d0172446c9.tar.bz2
c++: location of lambda object and conversion call
Two things that had poor location info: we weren't giving the TARGET_EXPR for a lambda object any location, and the call to a conversion function was getting whatever input_location happened to be. gcc/cp/ChangeLog: * call.c (perform_implicit_conversion_flags): Use the location of the argument. * lambda.c (build_lambda_object): Set location on the TARGET_EXPR. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/lambda/lambda-switch.C: Adjust expected location.
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 01ac114..4ee21c7 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -12549,7 +12549,11 @@ perform_implicit_conversion_flags (tree type, tree expr,
IMPLICIT_CONV_EXPR_BRACED_INIT (expr) = true;
}
else
- expr = convert_like (conv, expr, complain);
+ {
+ /* Give a conversion call the same location as expr. */
+ iloc_sentinel il (loc);
+ expr = convert_like (conv, expr, complain);
+ }
/* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p);