non-constant expression

Robby robby.lansaw at gmail.com
Wed Jan 24 07:35:34 PST 2007


is there a way I can do this in the module scope? I would have thought 
that since everything is known at compile time it would have flew, do I 
need to go about it in a different manner, or?

enum whatever
{
	one,
	two,
	three	
}
int whatever2(int x)
{
	return 1<< x;	
}

const int a = whatever2(whatever.one);
int b = whatever2(whatever.one);

testcode.d(11): Error: non-constant expression (whatever2)(0)
testcode.d(12): Error: non-constant expression (whatever2)(0)


More information about the Digitalmars-d-learn mailing list