www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22214] New: Regression 2.097.0: __traits(compiles) doesn't

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: nobody puremagic.com
          Reporter: default_357-line yahoo.de

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.

--
Aug 16