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.
@dkorpel created dlang/dmd pull request #14303 "Fix 23236 - can't initialize a @mustuse member in constructor" fixing this issue: - Fix 23236 - can't initialize a @mustuse member in constructor https://github.com/dlang/dmd/pull/14303
dlang/dmd pull request #14303 "Fix 23236 - can't initialize a @mustuse member in constructor" was merged into master: - 76a82b95a7fcfa4c381056a6040ea0d0bb0dcfab by Dennis Korpel: Fix 23236 - can't initialize a @mustuse member in constructor https://github.com/dlang/dmd/pull/14303