Bug 19415 – return non-copyable struct fails if member function has return attribute

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-11-20T01:32:48Z
Last change time
2021-04-09T10:29:18Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2018-11-20T01:32:48Z
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.
Comment #1 by razvan.nitu1305 — 2018-11-20T15:16:27Z
Comment #2 by github-bugzilla — 2018-11-22T06:15:20Z
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 <[email protected]>
Comment #3 by dlang-bot — 2021-04-09T10:29:18Z
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