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
Comment #2 by github-bugzilla — 2018-02-23T15:27:52Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/60e3422667a46b31f6d9d1cbcbe81479cfa71c6f Fix Issue 18503 - Confusing error message for erroneous postblit https://github.com/dlang/dmd/commit/75b460e65ee1c5c3506ff676793f20cb999da2ce Merge pull request #7943 from RazvanN7/Issue_18503 [Trivial review] Fix Issue 18503 - Confusing error message for erroneous postblit