[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 11:58:32 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4001
--- Comment #3 from Don <clugdbug at yahoo.com.au> 2010-03-24 11:58:27 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> < 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.
>
> Then how does the first pragma work? It uses the same const variable that
> supposedly isn't evaluatable at compile time in the second pragma...
>
> -Steve
I didn't express that very clearly. Const variables are not evaluated at
instantiation. It is permitted for a const variable to be determined at
runtime.
If a CTFE function call is made, all the arguments are interpreted before
calling the function. In the test case, it only becomes a compile-time value
while evaluating the pragma. (The pragma is forcing it to be a compile-time
value).
The bug is that this constant folding is not happening in template
instantiations, static assert, static if, etc.
--
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