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

          Issue ID: 22214
           Summary: Regression 2.097.0: __traits(compiles) doesn't notice
                    invalid getMember that yields type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Consider the following code:

struct S
{
    struct T
    {
    }
}

void main() {
    const S s;
    static if (__traits(compiles, { auto t = __traits(getMember, s, "T"); }))
    {
        auto t = __traits(getMember, s, "T");
    }
}

Since 2.097.0, this fails inside the static if.

Apparently, __traits(compiles) doesn't notice that "auto t = s.T;" is invalid.

--

Reply via email to