[Issue 15936] New: misleading error message about @disable where there is none
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Apr 17 11:00:31 PDT 2016
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: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
Found by denizzzka who posted to D.learn:
http://forum.dlang.org/post/qbrfftrhiiaotcormyee@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".
--
More information about the Digitalmars-d-bugs
mailing list