[Issue 14678] New: Bogus cannot create a struct until its size is determined error

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 10 13:47:48 PDT 2015


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

          Issue ID: 14678
           Summary: Bogus cannot create a struct until its size is
                    determined error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: deadalnix at gmail.com

See sample code:

enum AstTypeKind {
    Foo,
    Bar,
}

struct AstType {
    mixin TypeMixin!(AstTypeKind, Payload);

    this(AstTypeKind) {
    }

    import othermodule;
}

alias ParamAstType = AstType.ParamType;

union Payload {
    ParamAstType* params;
}

template TypeMixin(K, Payload) {

    Payload payload;

    alias ParamType = PackedType!(typeof(this));

    struct PackedType(T, U...) {

        Payload payload;

        auto getType() {
            return T(AstTypeKind.Foo);
        }
    }
}

Other module can be an empty file. What is in it doesn't matter, the import
being there is the only thing that does matter.

Line 32: Error: cannot create a struct until its size is determined
Line 25: Error: template instance type.AstType.TypeMixin!(AstTypeKind,
Payload).PackedType!(AstType) error instantiating

--


More information about the Digitalmars-d-bugs mailing list