digitalmars.D.bugs - [Issue 23236] New: can't initialize a mustuse member in constructor
- d-bugmail puremagic.com (31/31) Jul 10 2022 https://issues.dlang.org/show_bug.cgi?id=23236
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. --
Jul 10 2022