[Issue 19415] New: return non-copyable struct fails if member function has return attribute
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 20 01:32:48 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19415
Issue ID: 19415
Summary: return non-copyable struct fails if member function
has return attribute
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schveiguy at yahoo.com
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.
--
More information about the Digitalmars-d-bugs
mailing list