www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23726] New: Array append in CTFE no longer works without

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

          Issue ID: 23726
           Summary: Array append in CTFE no longer works without
                    _d_arrayappendT
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zach-dmd cs.stanford.edu

Here is my test.d file:

```
alias foo = () {
    string x = "1";
    x ~= "2";
    return x;
};

enum string bar = foo();
```

and minimal object.d file:

```
module object;

alias string = immutable(char)[];
```

Compiling with DMD v2.102.0 causes

```
$ dmd -c -betterC test.d
test.d(3): Error: `object._d_arrayappendT` not found. The current runtime does
not support appending array to arrays, or the runtime is corrupt.
```

But compiling with D frontend v2.100.1 works fine (I have been testing with LDC
1.30, based on D frontend v2.100.1).

It seems likely this was introduced between v2.101 and v2.102 but I haven't
looked in detail.

I'm not sure if this use-case is supposed to be supported, but it does break
code that previously worked and did not need an implementation of
`_d_arrayappendT`.

--
Feb 17 2023