[Issue 21428] New: Appending to keys of an empty associative array "cannot be interpreted at compile time"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 26 13:08:50 UTC 2020


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

          Issue ID: 21428
           Summary: Appending to keys of an empty associative array
                    "cannot be interpreted at compile time"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: CTFE, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

import std.algorithm;

auto foo() {
    bool[string] p;
    return p.keys ~ "bar";
}

enum a = foo;

void main() {
}

onlineapp.d(7): Error: keys(p) ~ ["bar"] cannot be interpreted at compile time
onlineapp.d(10):        called from here: foo()

Compiles if the array is not empty or p.keys are appended to indirectly.

--


More information about the Digitalmars-d-bugs mailing list