[Issue 1594] version not honored for invarient declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 18 23:53:12 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1594





------- Comment #1 from ddparnell at bigpond.com  2007-10-19 01:53 -------
I know its not intuitive but the compiler is behaving correctly. All the code
inside a version block must be valid code for the compiler you are using.

Here is how you need to do what you want to achieve...

version(D_Version2)
{
        string str = "Version 2";
        mixin("invariant int myint = 2;");
}

else
{
        string str = "Version 1";
        const int myint = 1;
}


-- 



More information about the Digitalmars-d-bugs mailing list