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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 23 08:48:32 PDT 2015


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

Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Rainer Schuetze <r.sagitario at gmx.de> ---
Sorry, I reduced the issue too far. The actual case where it happened is in
https://github.com/D-Programming-Language/phobos/pull/3764. This is similar to
this which fails:

enum check(R) = is(what) && is(R == what);

@property bool isDir(R)(R name) if (check!R)
{
    return true;
}

@property bool isDir(R)(R name) if (!check!R)
{
    return false;
}

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

On the other hand, it compiles if check is declared as:

template check(R)
{
    static if (is(what) && is(R == what))
        enum check = true;
    else
        enum check = false;
}

But that's documented special behaviour of "&&" for "static if", so I'll close
this.

--


More information about the Digitalmars-d-bugs mailing list