[Issue 22214] New: Regression 2.097.0: __traits(compiles) doesn't notice invalid getMember that yields type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 16 12:01:37 UTC 2021


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 at puremagic.com
          Reporter: default_357-line at 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.

--


More information about the Digitalmars-d-bugs mailing list