struct S { int x; S foo() return { return S(x); } this(this) @disable; } S bar() { S s; return s; // Error: struct `S` is not copyable because it is annotated with @disable } This fails to compile, unless you comment out the `foo` member. It seems completely unrelated, as it's never called. This expectation of being able to return a local as an rvalue is paramount inside std.algorithm.move.
PR: https://github.com/dlang/dmd/pull/8983
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/487a8c5f725f831f47e96c7417d50ed765daa22b Fix Issue 19415 - return non-copyable struct fails if member function has return attribute https://github.com/dlang/dmd/commit/cba9e0bd80cc58919efee1a08cb49ecb087b2595 Merge pull request #8983 from RazvanN7/Issue_19415 Fix Issue 19415 - return non-copyable struct fails if member function has return attribute merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
dlang/dmd pull request #12411 "[dmd-cxx] fix Issue 21813 - [REG-master] Bootstrap broken from dmd-cxx baseline" was merged into dmd-cxx: - 31e20d648ba820f62c9fe5b88553dae834937a3c by RazvanN7: [dmd-cxx] Fix Issue 19415 - return non-copyable struct fails if member function has return attribute https://github.com/dlang/dmd/pull/12411