[Issue 1924] fail to pragma compile time constant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 14 22:23:08 PDT 2008


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


davidl at 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #2 from davidl at 126.com  2008-03-15 00:23 -------
char[] wrongfunc()
{
    char[] result="void main()";
    result ~= "{}";
    const char[] myresult= result;
    pragma(msg, myresult);       // fail at this line
    return result;
}
mixin(wrongfunc);

abc.d(6): Error: string expected for message, not 'result'

pragma here is clearly for debugging CTFE. I don't want to make it as the
following 

char[] getresult()
{
    char[] result="void main()";
    result ~= "{}";
    return result;
}
char[] myfunc()
{
    const char[] result = getresult();
    pragma(msg,result);
    return result;
}
mixin(myfunc);

it's way dummier for debugging CTFE, especially if i want to do only some
simple inspect on some particular vars.


-- 



More information about the Digitalmars-d-bugs mailing list