https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #6) > Slightly further reduced #c3: > template <typename T> constexpr T bar (T c) { return c; } > template <typename T, typename U> struct S { > T f; > U g; > constexpr S (T c, U h) : f(c), g(h) {} > }; > template <typename T, typename U> > constexpr S<T, U> foo (T &&c, U h) { return S<T, U> (c, bar (h)); } > struct C { void baz (int); void qux (); }; > void C::baz (int a) { foo (a, ""); } > void C::qux () { foo (0, ""); } > > Seems some TARGET_EXPR is not unshared during the constexpr evaluation. The expression that isn't being unshared here is &"", which is built in baz, cached as the result of bar(&""), and reused when we again see bar(&"") while evaluating the call to foo in qux. This seems like reasonable sharing to me, but perhaps we should strip locations from cached results.