[Issue 13379] Latest dmd fails with recursive template expansion in std.regex

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 26 18:29:57 PDT 2014


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

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
Reduced test case:

void main()
{
    match("");
}

// Instantiating Regex!char in template constraint
auto match(RegEx )(RegEx  re) if (is(RegEx == Regex!(char))) {}
auto match(String)(String re) {}

struct Regex(Char)
{
    ShiftOr!Char kickstart;
}
struct ShiftOr(Char)
{
    this(ref Regex!Char re)    // Regex!Char is necessary
    {
        uint n_length;
        uint idx;
        n_length = min(idx, n_length);
    }
}

MinType!T min(T...)(T args)// if (T.length == 2)
{
    alias a = args[0];
    alias b = args[$-1];
    return cast(typeof(return)) (a < b ? a : b);
}
template MinType(T...)// if (T.length == 2)
{
    alias MinType = T[0];
}

--


More information about the Digitalmars-d-bugs mailing list