https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83912
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |nathan at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think for this to work the NRV optimization would need to happen very early so that we see that the c3.m_ptr field is actually &c3.m_value rather than &<temporary>.m_value for a temporary that will be later on NVR optimized to the RESULT_DECL and eventually to c3. If you do: void foo () { constexpr auto c_4 = make_instance(34); } clang++ rejects it too. So the question is, does the standard mandate NRV to happen here in the c_3 case and when the NRV optimization happens wrt. constexpr evaluation.