www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14416] New: .sizeof yields 1 for uninstantiated struct

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

          Issue ID: 14416
           Summary: .sizeof yields 1 for uninstantiated struct templates
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Consider:

struct S(T)
{
    int x;
}

void main()
{
    import std.stdio;
    writeln(S.sizeof);
    writeln(S!int.sizeof);
}

This program prints 1 4. The first call shouldn't compile.

--
Apr 05 2015