https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43486
--- Comment #12 from David Malcolm <dmalcolm at gcc dot gnu.org> --- (In reply to David Malcolm from comment #11) > Author: dmalcolm > Date: Wed Jan 10 19:40:55 2018 > New Revision: 256448 > > URL: https://gcc.gnu.org/viewcvs?rev=256448&root=gcc&view=rev > Log: > Preserving locations for variable-uses and constants (PR c++/43486) This patch is a step towards fixing this bug, but we're not there yet: The patch adds machinery for adding location wrapper nodes for those expressions that don't have them, and adds such wrappers to the C++ FE for callsite arguments and at a few other places. This is a minimal approach, which improves various diagnostics in the C++ FE, but in theory we should add wrappers throughout the C++ FE for *all* uses-of-decls and uses-of-constants. See: https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01588.html for an earlier work-in-progress attempt at this (probably bit-rotted by now). Similarly, the patch doesn't add any wrapper nodes to other frontends, in particular, the C FE. Finally, I believe, all of these wrappers are discarded at some point at or before gimplification, so it doesn't help the middle-end yet; we'd need some way to retain the location information there.