digitalmars.D.bugs - [Issue 16444] New: Less noisy error messages if built-in method is
- via Digitalmars-d-bugs (49/49) Aug 29 2016 https://issues.dlang.org/show_bug.cgi?id=16444
https://issues.dlang.org/show_bug.cgi?id=16444 Issue ID: 16444 Summary: Less noisy error messages if built-in method is disable (e.g. opAssign) Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: greensunny12 gmail.com When a builtin-in method like opAssign is disabled, the error messages are quite noisy: struct A { disable void opAssign(Other)(Other other); } pure nothrow safe nogc unittest { A a; a = A(); } foo.d(16): Error: function foo.A.opAssign!(A).opAssign is not callable because it is annotated with disable foo.d(16): Error: pure function 'foo.__unittestL13_1' cannot call impure function 'foo.A.opAssign!(A).opAssign' foo.d(16): Error: safe function 'foo.__unittestL13_1' cannot call system function 'foo.A.opAssign!(A).opAssign' foo.d(16): Error: nogc function 'foo.__unittestL13_1' cannot call non- nogc function 'foo.A.opAssign!(A).opAssign' foo.d(16): Error: function 'foo.A.opAssign!(A).opAssign' is not nothrow foo.d(13): Error: function 'foo.__unittestL13_1' is nothrow yet may throw There is a trick that is used in https://github.com/dlang/phobos/pull/4755, one can simply annotate the disabled function with all attributes: struct B { pure nothrow safe nogc disable void opAssign(Other)(Other other); } pure nothrow safe nogc unittest { B b; b = B(); } foo.d(16): Error: function foo.B.opAssign!(B).opAssign is not callable because it is annotated with disable --
Aug 29 2016