https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63657
--- Comment #4 from petschy at gmail dot com --- Sorry, but this is definitely not the same issue. Bug 38958 is about returning by value and binding to a reference. This issue is about returning a REFERENCE and binding it to a reference. No class ctor/dtor/copy is involved, references are just syntactic sugar on pointers: a single pointer is returned and stored locally. This is 100% sure, since in the production code the bug appeared with a singleton which is not constructible/destructible/copyable to the outside world. Please reopen the issue.