https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82309
--- Comment #6 from Sergey Markelov <sergio_nsk at yahoo dot de> --- (In reply to Andrew Pinski from comment #5) > The temp variable goes out if scope is the result of v0 + v1. And not the > auto. IIRC -fsanitize=undefined will catch this. Yes, I agree, I understood it from your previous comment. Sorry, I was mistaken with the extra minimized bug.cpp, so you can not see Vector constructor from 'VectorSum'. 'auto sum = v0 + v1 + v2' deduces the type VectorSum<VectorSum<Vector, Vector> Vector> with a reference to a temp variable of the type VectorSum<Vector, Vector>. 'Vector sum = v0 + v1 + v2' sums and copies values during the temp scope is valid. Unfortunately -fsanitize=undefined does not catch this. Thank you for your help.