www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22659] New: [REG master] Error: declaration '(S[2] arr =


          Issue ID: 22659
           Summary: [REG master] Error: declaration '(S[2] arr =
                    __error__;)' is not yet implemented in CTFE
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

When there is a mismatch between compiler and run-time, or the body fails to
compile for whatever reason, bad errors with the new templated lowerings ensue.

This was caused by recent gagging that is now done in the front-end.


module object;

alias size_t = typeof(int.sizeof);
extern(C) void* memcpy(return void* s1, scope const void* s2, size_t n) pure;

Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from)
    Tarr1 to;
    memcpy(to.ptr, from.ptr, to.length * T1.sizeof);
    *cast(size_t *)&to = from.length;
    return to;

bool test9245()
    struct S
        this(this) { }

    S[2] arr;
    S[2] arr2 = arr;

    return true;
static assert(test9245());

Jan 08 2022