[Issue 4001] ctfe return value is handled incorrectly when used as template argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 24 01:28:48 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-03-24 01:28:46 PDT ---
This isn't actually a CTFE problem. The issue is that constant folding isn't
being performed on const variables with initializers. BTW in the original bug,
you can replace 'const' with 'enum' and it will work fine. Note that const
variables are NOT evaluated at compile time. But in these kind of situations,
it should do the same thing it does with a CTFE function call.

Reduced test case:
----
int space() { return 4001; }

void oddity4001()
{
    const int bowie = space();    
    static assert(space() == 4001); // OK
    static assert(bowie == 4001);   // doesn't compile
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list