Comment #0 by bearophile_hugs — 2014-02-15T01:52:12Z
import std.algorithm: sum;
void main() {
enum int[] arr1 = [10, 20];
int[arr1.sum] arr2;
}
dmd 2.065beta3 gives:
test.d(4,19): Error: no property 'sum' for type 'int[]'
Comment #1 by monarchdodra — 2014-02-27T04:41:24Z
Seems unrelated to sum. The same issue happens with any function called UFCS, without parens. It also happens regardless of input type. For example:
//----
size_t foo(int) {return 1;}
size_t bar() {return 1;}
void main() {
enum int a = 0;
enum i = 5.foo; //OK!
enum j = a.foo; //OK!
enum k = bar; //OK!
int[5.foo] arr1; //OK!
int[a.foo] arr2; //NOPE
int[bar ] arr3; //NOPE
}
//----
The issue appears to simply be that parentless calls in a array-length context doesn't work? Strangely enough, it works with literals though.
Maybe http://d.puremagic.com/issues/show_bug.cgi?id=11247
Is related?
Changing name.
Comment #2 by razvan.nitu1305 — 2017-09-05T14:09:47Z
This code successfully compiles on git HEAD ubuntu 16.04. Closing as fixed.
Comment #3 by razvan.nitu1305 — 2017-09-05T14:11:21Z
Seeing as the platform on which the bug was reported is windows, I modified to WORKSFORME, if anyone has a windows platform, please try the example and reopen if necessary.