On Mon, 04 May 2015 18:21:59 +0200, Robert M. Münch wrote:

> I find this a bit strange:
> 
> // get all rules that start with p...
> enum BolRules = StaticFilter!(beginsWithP,
> __traits(allMembers,BolSource));
> static assert(is(BolRules == enum));
> 
> Compiling using dmd...
> source/app.d(114): Error: static assert  (is(BolRules == enum)) is false
> 
> I'm trying to construct an enum that can be used in a "final switch" to
> check if all cases were handled. But so far it's not working, because I
> can't get the enum constructed.

that's due to `enum` keyword abusing. "enum type" is something like this:

  enum MyEnum { A, B }

and

  enum val = false;

is a compile-time boolean constant, which will be inlined on using. i.e. 
compiler will inline such "enum constants", and that constants has the 
corresponding type, they aren't enums.

Attachment: signature.asc
Description: PGP signature

Reply via email to