www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15240] New: errors in isExpression with == not gagged when

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

          Issue ID: 15240
           Summary: errors in isExpression with == not gagged when used in
                    constraint
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de

static if (is(R == what)) pragma(msg, "hi");

 property bool isDir(R)(R name) if (is(R == what))
{
    return true;
}

 property bool isDir(R)(R name) if (!is(R == what))
{
    return false;
}

void foo()
{
    isDir!int(0);
}

The first line with the "static if" does not show an error, while the
contraints produce:

test.d(5): Error: undefined identifier 'what'
test.d(10): Error: undefined identifier 'what'
test.d(17): Error: template athis.isDir cannot deduce function from argument
types !(int)(int), candidates are:
test.d(5):        athis.isDir(R)(R name) if (is(R : what))
test.d(10):        athis.isDir(R)(R name) if (!is(R : what))

The same happens for ':' instead of '=='.

--
Oct 23 2015