[Issue 17716] New: wrong result of IsExpression when not in static assert

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 3 10:26:04 PDT 2017


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

          Issue ID: 17716
           Summary: wrong result of IsExpression when not in static assert
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

----
struct S { shared int* foo; int* bar; }
static assert(!is(shared S : S)); /* passes */
pragma(msg, is(shared S : S)); /* "true" */
static if (is(shared S : S))
{
    static assert(false); /* is triggered */
}
----

The `static assert` is correct.
The `pragma(msg, ...);` should print "false":
The body of the `static if` should not be entered.

Also happens with other qualifiers (const, immutable).
Depends on the order of the struct fields. When the unqualified fields comes
first, everything works as expected.

--


More information about the Digitalmars-d-bugs mailing list