digitalmars.D.bugs - [Issue 24248] New: const constructor with mutable target gives wrong
- d-bugmail puremagic.com (34/34) Nov 16 2023 https://issues.dlang.org/show_bug.cgi?id=24248
https://issues.dlang.org/show_bug.cgi?id=24248 Issue ID: 24248 Summary: const constructor with mutable target gives wrong error message Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: nick geany.org struct S2 { this(int) const {} int* i; } void main() { S2 s2 = S2(5); } Error: constructor `const_ctor.S2.this(int __param_0) const` is not callable using argument types `(int)` Which is confusing as the only parameter the user sees does actually match correctly. It should instead say: Error: `const` constructor `const_ctor.S2.this` cannot construct a mutable object Which is the style of wording you get if the constructor is declared as status quo is for immutable is much better than for const). PR incoming. --
Nov 16 2023