[Issue 18310] New: __traits(isDisabled) returns true for non-function struct member annotated with @disable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 26 22:49:23 UTC 2018


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

          Issue ID: 18310
           Summary: __traits(isDisabled) returns true for non-function
                    struct member annotated with @disable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: hsteoh at quickfur.ath.cx

Code:
-------
struct S {
    @disable string toString();
}
static assert(__traits(isDisabled, S.toString)); // OK

struct T {
    @disable float toString;
}
static assert(__traits(isDisabled, T.toString)); // NG
-------

Expected behaviour: either annotating a non-function member with @disable
should be rejected with a compile error, or __traits(isDisabled) should return
true in that case.

--


More information about the Digitalmars-d-bugs mailing list