https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102942
Matthijs van Duin <matthijsvanduin at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matthijsvanduin at gmail dot com --- Comment #4 from Matthijs van Duin <matthijsvanduin at gmail dot com> --- This is indeed a duplicate of 89695. The copy constructor isn't being "elided", there's no semantic expectation of it being invoked at all, you're simply initializing the parameter of take(T) with a prvalue T(). As special exception however C++ permits parameters and return values of trivially-copyable types (such as int and StructWithImplicitCpyCtr) to be copied superfluously, which is what you're observing. This exception exists to allow C++ ABIs to pass such types in a C-ABI-compatible way, which may sometimes require copying (notably when passing small types in register for efficiency), though gcc seems to make a superfluous copy whenever it is _allowed_ rather than whenever it is _needed_.