Uri class and parser

Jonathan M Davis jmdavisProg at gmx.com
Thu Nov 8 15:51:30 PST 2012


On Friday, November 09, 2012 00:42:42 jerro wrote:
> > After trying your solution I found out I was calling
> > indexOf(string, char) which apparently is different than
> > indexOf(string, string) as I now no longer have that error.
> > Instead, when I call parse on compile time I get the following
> > at the method parse:
> > Error: URI class literals cannot be returned from CTFE
> 
> It looks like you can't have class enums. This fails too:
> 
> class A{}
> enum a = new A;
> 
> I don't think you can get around this

Nope. To some extent, classes can be used at compile time, but they can't 
persist from compile time to runtime. So, if you really want a type which is 
useable with CTFE, make it a struct, not a class.

- Jonathan M Davis


More information about the Digitalmars-d mailing list