static assert fouls up template promotion when between static if statements.

Don Clugston dac at nospam.com.au
Wed Feb 22 04:36:41 PST 2006


If you uncomment the indicated line, it won't compile.
(The fact that the others will compile is a really nice feature from DMD 
0.146).
Note that a failed template promotion can easily send the compiler into 
an error message orgy, which you unfortunately can't break out of with ^C.

template cat()
{
     static assert(1);  // OK
     static if (1) {
//       static assert(1); // doesn't work
        static if (1) {
             static assert(1);  // OK
             const int cat = 3;
        }
     }
}

void main() {
  const int a = cat!();
}



More information about the Digitalmars-d-bugs mailing list