On Thursday, 21 November 2013 at 07:22:39 UTC, Steve Teale wrote:
import std.stdio;

enum Intention
{
   EVIL,
   NEUTRAL,
   GOOD,
   SAINTLY
}

void foo(Intention rth)
{
   if (rth == EVIL)
      writeln("Road to hell");
}


void main()
{
   foo(EVIL);
}


Why does the compiler complain in both places about EVIL. Can it not work out which EVIL I mean? There's only one choice.

That should be:

if( rth == Intention.EVIL ) and
foo( Intention.EVIL );

Reply via email to