www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14273] New: Predicates for static assert pass depending on

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

          Issue ID: 14273
           Summary: Predicates for static assert pass depending on order
                    of asserts
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: monkeyworks12 hotmail.com

template canBeAlias(T...)
if (T.length == 1)
{
    enum canBeAlias = is(typeof({ alias _ = T[0]; }));
}

static assert(canBeAlias!(canBeAlias!canBeAlias));
//Error: static assert (!true) is false
static assert(!canBeAlias!true);

If we switch the order:

static assert(!canBeAlias!true);
//Error: static assert (canBeAlias!(true)) is false
static assert(canBeAlias!(canBeAlias!canBeAlias));

--
Mar 10 2015