[dmd-internals] Don's CTFE overhaul – bug reports?

Don Clugston dclugston at googlemail.com
Mon Apr 18 14:06:42 PDT 2011


This turns out to be a pre-existing bug, which I've added as bug5852.
It's quite serious.
Pull request which fixes this:
https://github.com/D-Programming-Language/dmd/pull/33


On 18 April 2011 01:55, David Nadlinger <code at klickverbot.at> wrote:
> Another regression present in Git master (186b6a0):
>
> ---
> class Foo {
>    void bar() {}
> }
>
> string[] getSymbols(C)() {
>    string[] result;
>    foreach(s; __traits(derivedMembers, C)) {
>        result ~= s;
>    }
>    return result;
> }
>
> enum s = getSymbols!Foo();
>
> // Prints »string[]: bar, length: 3u« instead of
> // »string[]: ["bar"], length: 1u«.
> pragma(msg, typeof(s), ": ", s, ", length: ", s.length);
>
> // Trying to access something fails with:
> // »integral constant must be scalar type, not string«.
> enum f = s[0];
> ---
>
> Somehow, s seems to refer to the element of the string[] array ("bar"),
> instead of to the array itself (["bar"]).
>
> David
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals


More information about the dmd-internals mailing list