[Issue 12484] New: Template Overloading or Pattern Matching Failure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 27 15:28:25 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12484

           Summary: Template Overloading or Pattern Matching Failure
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: monkeyworks12 at hotmail.com


--- Comment #0 from monkeyworks12 at hotmail.com 2014-03-27 15:28:24 PDT ---
I'm not sure which is failing here, but this doesn't work (and I'm pretty sure
it should).

struct Zero    {}
struct Succ(a) {}

alias One = Succ!Zero;

struct Less    {}
struct Equal   {}
struct Greater {}

struct Cmp(x: Zero,   y: Zero,      c: Equal)   {}
struct Cmp(x: Zero,   y: Succ!n, n, c: Less)    {}
struct Cmp(x: Succ!n, y: Zero,   n, c: Greater) {}

void main()
{
    assert(is(Cmp!(Zero, Zero, Equal)));   //Ok
    assert(is(Cmp!(Zero, One,  Less)));    //Fails
    assert(is(Cmp!(One,  Zero, Greater))); //Fails
}

The error message given in both cases is:

Error: struct Cmp does not match any template declaration

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list