June 26 [Issue 24634] New: CTFE on static arrays with StructInitializers fails to compile | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24634 Issue ID: 24634 Summary: CTFE on static arrays with StructInitializers fails to compile Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Keywords: CTFE Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: mail@tomaskral.sk Compiling the following code fails with: Error: found `}` when expecting `;` following expression ``` struct A { int val; } enum A[2] as = [{0}, {1}].update; auto update(A[] as) { foreach (ref a; as) a.val++; return as; } ``` Interestingly, if I replace struct initializers with struct ctors, e.g.: ``` enum A[2] as = [A(0), A(1)].update; ``` the code compiles just fine. -- |
Copyright © 1999-2021 by the D Language Foundation