strong enums: why implicit conversion to basetype?

Manfred Nowak svv1999 at hotmail.com
Thu Jan 26 06:45:02 PST 2012


Trass3r wrote:

> but by using named enums I made clear that Bla and Blub are 
> totally different

No. Obviously you decjlared both to be implicitely convertable to a 
common super type: int. To change this, both supertypes have be 
changed.

The impßlementation is unfortenatey broken:

void main(){
	enum INT1{ DUMMY};
	enum MY1:INT1{ A};
}

Error: cannot implicitly convert expression (0) of type int to INT1

-manfred


More information about the Digitalmars-d mailing list