[Issue 13995] New: Alias type stringof decay to alias type stringof

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 17 10:19:05 PST 2015


https://issues.dlang.org/show_bug.cgi?id=13995

          Issue ID: 13995
           Summary: Alias type stringof decay to alias type stringof
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: deadalnix at gmail.com

alias T = int;
writeln(T.stringof);

Print int. This do not look like a big issue, but it makes most mixin fails,
including phobos's ones, when used in templates. Things like this are going to
fail hard with a very obscure error :

module a;

template Foo(T) { mixin(someting that use T.stringof); }

module b;

class C {}

import a;
Foo!C;

stringof will resolve as C, which do not exist in the template Foo, and all
come to an halt.

This is causing a lot of trouble in SDC right now to pack thing in bitfield.
Packing data is crucial for performance and memory consumption.

--


More information about the Digitalmars-d-bugs mailing list