digitalmars.D.bugs - [Issue 21870] New: Property/method not invoked and requires () when
- d-bugmail puremagic.com (32/32) Apr 27 2021 https://issues.dlang.org/show_bug.cgi?id=21870
https://issues.dlang.org/show_bug.cgi?id=21870 Issue ID: 21870 Summary: Property/method not invoked and requires () when used in static array length Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic, rejects-valid Severity: normal Priority: P3 Component: dmd Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net ////////////////////////////// test.d ///////////////////////////// struct S { property size_t count() const { return 1; } } int[S.init.count()] x; // OK int[S.init.count ] y; // error // Error: need `this` for `count` of type `const property ulong()` /////////////////////////////////////////////////////////////////// Additionally, the error message is misleading. Older versions of compilers produced a better error: 2.079.0 to 2.087.1: Failure with output: test.d(9): Error: integer constant expression expected instead of `S().count` --
Apr 27 2021