Using enum constant from different modules

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 10 13:27:38 PDT 2014


Here's a code example:

module main;

import foo;

enum Get = "GET";

void bar (string a)
{
     assert(a is Get);
}

void main ()
{
     asd();
}

module foo;

import main;

void asd()
{
     bar(Get);
}

Running the above code will cause an assert error in the function "bar". 
But if I move the function "asd" into the "main" module and completely 
skip the "foo" module the assert passes.

I don't know if I'm thinking completely wrong here but this seems like a 
bug to me.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list