On 17 September 2013 10:52, Iain Buclaw <ibuc...@ubuntu.com> wrote: > I've implemented this in gdc. > > https://github.com/D-Programming-GDC/GDC/commit/021dda8feaba282fec60600729ba8abc2c64cf81 > >
Now done the same for manifest constants. https://github.com/D-Programming-GDC/GDC/commit/6b40c481068530374abb0819b80c7d2ef09072fd --- enum A { a = 42, b = 45 } enum foo = A.a; void main() { enum bar = A.b; enum baz = &main; return; } -- (gdb) print 'test.foo' $1 = enum.A.a (gdb) print bar $2 = enum.A.b (gdb) print baz $3 = (void (* const)(void)) 0x402a00 <D main> (gdb) p (int)bar $4 = 45 Note that these values are purely in the debug code only - they are not addressable in memory, and are not emitted in non-debug object files/binaries - meaning there is no bloat added. (gdb) p &'test.foo' Can't take address of "test.foo" which isn't an lvalue. (gdb) p &baz Can't take address of "baz" which isn't an lvalue. Hope this helps those who use CTFE a lot. ;-) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';