www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18503] New: Confusing error message for erroneous postblit


          Issue ID: 18503
           Summary: Confusing error message for erroneous postblit
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: razvan.nitu1305 gmail.com

This code:

class C
    this(this) {}


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) {}


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

Feb 23 2018