www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Integer constant expression expected instead of 1 == 1 ? 4 : 4 >

It's erroring on a valid integer constant expression :-/

DMC version 8.38

Integer constant expression expected instead of 1 == 1 ? 4 : 4 > 1 ? 1 : 4

I've worked around it using enums instead...but it's messier


import std.file;

template T(int a) {
    int vec[a];
}
int main (char[][] args)
{
     printf ("%d\n",T!(4>1?4:1).vec[0]);// <-- succeeds
     printf("%d\n",T!(4==1?1:(1==1?4:(4>1?1:4))).vec[0]); // <-- fails
     return 0;
}
Apr 30 2004