Undefined identifier error with enum in the separate module
Philippe Sigaud
philippe.sigaud at gmail.com
Sat Feb 1 13:03:35 PST 2014
> // Reply.d
> import CodeEnum;
>
> unittest
> {
> auto.e = CodeEnum.OK; // Error: undefined identifier 'OK'
> }
>
>
> What I am doing wrong?
The module and your enum have the same name. When the compiler sees
the `CodeEnum` symbol, it considers you're referring to the module.
This module does not have an `OK` member, hence the error.
In D, do not use the same symbol for a module and one of its inner symbols.
More information about the Digitalmars-d-learn
mailing list