July 10, 2022 [Issue 23236] New: can't initialize a @mustuse member in constructor | ||||
|---|---|---|---|---|
| ||||
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: nobody@puremagic.com Reporter: dkorpel@live.nl 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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply