[Issue 10586] DMD unable to interpret cascaded template calls at compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 10 02:54:16 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10586



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2013-07-10 02:54:12 PDT ---
Further reduced shows I'm wrong about it being enums:
------------
template FooParams(size_t K) {
  alias int X;
}

struct foo  {
    static const int SIZE = int.sizeof;
    alias FooParams!(SIZE).X Y;
}
-----------
bug.d(6): Error: Cannot interpret int at compile time
bug.d(7):        while evaluating SIZE.init
bug.d(7):        while looking for match for FooParams!(4)

---
A very difficult related case is this one:

const int Z = baz(3);
const int W = baz(2);

int baz(int k) {
    if (k == 3) return W;
    return 6;
}

static assert(Z == 6);

because it means that baz cannot be JIT-compiled. Arguably this is a circular
reference. It would be much simpler and would give better performance if we
disallowed pseudo-circular refs.

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


More information about the Digitalmars-d-bugs mailing list