https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110441
Bug ID: 110441 Summary: c++17 deferred materialization of temporaries fails when calling class static with member syntax Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com Target Milestone: --- struct immovable { immovable() = default; immovable(immovable &&) = delete; }; struct S { static immovable f() { return {}; } }; immovable g() { return S().f(); } compile with -std=c++17. Result: <source>: In function 'immovable g()': <source>:14:15: error: use of deleted function 'immovable::immovable(immovable&&)' 14 | return S().f(); | ~~~~~^~ <source>:4:3: note: declared here 4 | immovable(immovable &&) = delete; | ^~~~~~~~~ https://godbolt.org/z/Y1h9bPrf3