[Issue 12984] New: "Cannot interpret [template] at compile time" depending on order of declaration

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 24 12:03:41 PDT 2014


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

          Issue ID: 12984
           Summary: "Cannot interpret [template] at compile time"
                    depending on order of declaration
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: nilsbossung at googlemail.com

---
cat > test.d << code
template Tpl() {static if(true) enum Tpl = true;}
void f()() if(Tpl!());

class B {alias MyD = D!int;} // 4
class C : B {} // 5

class D(T) {alias MyE = E!float;}
class E(T) : D!int
{
    void m()
    {
        auto c = new C; // 12
        f(); // 13
    }
}
code
dmd -c -o- test.d
---
test.d(2): Error: Cannot interpret Tpl!() at compile time
test.d(7): Error: template instance test.E!float error instantiating
test.d(4):        instantiated from here: D!int
---

Works when lines 4 and 5 are swapped.
Works when lines 12 and 13 are swapped.

Possibly related to issue 12983.

--


More information about the Digitalmars-d-bugs mailing list