static foreach issues

Psychological Cleanup via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 5 19:05:13 PDT 2017


Nesting static foreach and using enum has latent problem.

static foreach()
   static foreach()
   {
      enum A = ;
   }

compiler complains because A is defined multiple times by the 
outer most foreach.

To fix this

static foreach()
   static foreach()
   {
      {
         enum A = ;
      }
   }

But then compiler complains about unexpected { if in a scope 
where normal {}'s are not expected.

So there is no way out of this conundrum? Maybe we need static {}?






More information about the Digitalmars-d mailing list