[Issue 8285] Error passing CTFE-generated string slice to template value parameter

Max Samukha maxsamukha at gmail.com
Sun Jun 24 07:35:09 PDT 2012


Reduced test case:

string foo()
{
      string s = "ab";
      return s[0 .. $];
}

template T2(string s)
{
}

template T1()
{
      enum s = foo();
      alias T2!(s) t2;
}

int bar()
{
      alias T1!() t1;
      return 0;
}

int baz(int x)
{
      return 0;
}

static assert(baz(bar()) == 0);

void main()
{
}

Error: expression "ab"[0u..2u] is not a valid template value
argument


More information about the Digitalmars-d-bugs mailing list