[Issue 7197] enum string doesn't work with CTFE

Geoffrey Brown erkle64 at gmail.com
Wed Jan 25 09:54:56 PST 2012


On Monday, 2 January 2012 at 02:15:21 UTC, bearophile_hugs at eml.cc 
wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=7197
>
>
> bearophile_hugs at eml.cc changed:
>
>          What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                CC|                            
> |bearophile_hugs at eml.cc
>
>
> --- Comment #1 from bearophile_hugs at eml.cc 2012-01-01 18:15:19 
> PST ---
> Reduced a bit:
>
>
> int foo(int[] x...) {
>   return 0;
> }
> template bar(y...) {
>   enum int bar = foo(y);
> }
> enum int z = 1;
> enum int w = bar!(z);
> void main() {}

Weird, it can be fixed by changing z to a const:
int foo(int[] x...) { return 0; }
template bar(y...) { enum int bar = foo(y); }
const int z = 1;
enum int w = bar!(z);
void main() {}

I'm unable to upgrade to 2.057 because of this bug, it works fine 
in 2.056.


More information about the Digitalmars-d-bugs mailing list