https://issues.dlang.org/show_bug.cgi?id=23236
Issue ID: 23236
Summary: can't initialize a @mustuse member in constructor
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This should compile:
```
import core.attribute;
@mustuse struct MyError { }
struct S
{
MyError lastError;
this(int x)
{
this.lastError = MyError(); // Error: ignored value of `@mustuse` type
`onlineapp.MyError`; prepend a `cast(void)` if intentional
}
}
```
Assignment seems to work, but initialization is not considered ignoring the
value.
--