www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17716] New: wrong result of IsExpression when not in static

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 puremagic.com
          Reporter: ag0aep6g 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.

--
Aug 03