https://issues.dlang.org/show_bug.cgi?id=15936

          Issue ID: 15936
           Summary: misleading error message about @disable where there is
                    none
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: ag0ae...@gmail.com

Found by denizzzka who posted to D.learn:
http://forum.dlang.org/post/qbrfftrhiiaotcorm...@forum.dlang.org

----
struct Vector
{
    void opAssign(Vector u) {}
}

struct RAMNode
{
    Vector min;
    const bool isLeafNode = false;
}

void main()
{
    RAMNode old_root;
    old_root = RAMNode.init; /* line 15 */
}
----

This code can't compile because isLeafNode is const.

dmd gets confused by the opAssign, though, and prints: "test.d(15): Error:
function test.RAMNode.opAssign is not callable because it is annotated with
@disable". That's nonsense. There is no @disable anywhere.

Without the opAssign the error message is ok: "test.d(15): Error: cannot modify
struct old_root RAMNode with immutable members".

--

Reply via email to