www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19598] New: CTFE fails to assign struct

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

          Issue ID: 19598
           Summary: CTFE fails to assign struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

int test()
{
    int t0;
    int* n0 = new int;
    *n0 = t0;

    struct S { int x; }
    S t1;
    S* n1 = new S;
    *n1 = t1;

    return 10;
}
pragma(msg, test());


The int assigns fine, the struct with an int member doesn't.
Is there a workaround?

--
Jan 20 2019