Bug 14531 – `@disable this() immutable` disable mutable default construction, too

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-04-30T07:47:18Z
Last change time
2022-02-17T11:31:43Z
Assigned to
No Owner
Creator
Marc Schütz

Comments

Comment #0 by schuetzm — 2015-04-30T07:47:18Z
struct S { @disable this() immutable; } void main() { S s; } => xx.d(6): Error: variable xx.main.s default construction is disabled for type S
Comment #1 by razvan.nitu1305 — 2022-02-17T11:31:43Z
It doesn't matter whether the default constructor is annotated with immutable or not since its result is always going to be unique (nobody else has access to it), therefore it can be implicitly converted to any combination of qualifiers. The compiler doesn't even look at the qualifier in this case. So this issue is invalid.