Bug 18503 – Confusing error message for erroneous postblit
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-23T12:21:32Z
Last change time
2018-02-23T15:27:53Z
Assigned to
No Owner
Creator
RazvanN
Comments
Comment #0 by razvan.nitu1305 — 2018-02-23T12:21:32Z
This code:
class C
{
this(this) {}
}
issues:
test.d(3): Error: postblit can only be a member of struct/union, not class C
Ok. Let's define a union with a postblit:
union D
{
this(this) {}
}
output:
test.d(8): Error: function `test.D.__postblit` destructors, postblits and invariants are not allowed in union D
That's odd, you just instructed me that a union can have a postblit! Shame on you compiler!
Spec: "Unions may not have postblits, destructors, or invariants." [1]
[1] https://dlang.org/spec/struct.html
Comment #1 by razvan.nitu1305 — 2018-02-23T12:25:12Z