[Bug 33] No short-circuit evaluation for compile-time expressions?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 13 05:25:16 PST 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=33





------- Comment #1 from clugdbug at yahoo.com.au  2006-03-13 07:25 -------
Definitely a bug -- but maybe not in &&. This example compiles:

void main()
{
    const char [] s = int.mangleof;
    static if( s.length > 1 && s[1] == 'x' )
        printf( "'x' as second char\n" );
}

And this one gives a quite bizarre error message:

void main()
{
    const char [] s = (int*).mangleof;
    static if( s.length > 1 && s[2] == 'x' )
        printf( "'x' as second char\n" );
}

something about TOK58 doesn't evaluate to a boolean.


-- 




More information about the Digitalmars-d-bugs mailing list