Bug 24247 – Improve constructor not callable using $modifier object error

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-11-16T16:20:06Z
Last change time
2023-11-16T22:56:17Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Nick Treleaven

Comments

Comment #0 by nick — 2023-11-16T16:20:06Z
struct S1 { this(ref const S1 s) immutable { } int i; } void main() { const(S1) s1; S1 ms1 = s1; } Error: `immutable` method `immutable_ctor.S1.this` is not callable using a mutable object This should be changed to: Error: `immutable` constructor `immutable_ctor.S1.this` cannot construct a mutable object
Comment #1 by dlang-bot — 2023-11-16T16:21:40Z
@ntrel created dlang/dmd pull request #15826 "[dmd/func.d] Improve 'method not callable using a $mod object' error" fixing this issue: - Add test Fix Issue 24247 - Improve constructor not callable using $modifier object error https://github.com/dlang/dmd/pull/15826
Comment #2 by dlang-bot — 2023-11-16T19:45:04Z
@ntrel created dlang/dmd pull request #15827 "Fix Issue 24248 - const constructor call with mutable target gives wrong error message" fixing this issue: - Add test Fix Issue 24247 - Improve constructor not callable using $modifier object error https://github.com/dlang/dmd/pull/15827
Comment #3 by dlang-bot — 2023-11-16T22:56:17Z
dlang/dmd pull request #15826 "[dmd/func.d] Reword 'method not callable using a $mod object' error for constructors" was merged into master: - 5cf5959e9f3d7376dc8b6eb724198cd459bb1349 by Nick Treleaven: Add test Fix Issue 24247 - Improve constructor not callable using $modifier object error https://github.com/dlang/dmd/pull/15826