March 03, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12294

           Summary: CTFE fails with inherited in contract
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: destructionator@gmail.com


--- Comment #0 from Adam D. Ruppe <destructionator@gmail.com> 2014-03-03 12:04:17 PST ---
class Foo {
        int add(int a)
           in { assert(a > 0);   }
           body { return a + 10; }
}

class Bar : Foo {
        override int add(int a)
            in { assert(a <= 0 || a > 0); }
            body {  return a + 10; }
}

void main() {
        // contracts.d(4): Error: variable a cannot be read at compile time
        //enum a = new Bar().add(-5); // error

        enum b = new Foo().add(5); // works
}


Since both of them are int literals, it seems like it should work in CTFE, and it indeed does with a simple case, but once inheritance gets involved, the contract seems to get confused.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 04, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12294


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE
          Component|druntime                    |DMD


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2014-03-03 18:17:04 PST ---
This is DMD issue.

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