[Issue 15240] New: errors in isExpression with == not gagged when used in constraint

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 23 01:47:37 PDT 2015


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 at puremagic.com
          Reporter: r.sagitario at 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 '=='.

--


More information about the Digitalmars-d-bugs mailing list