Bug 9883 – Error on using property as new dynamic array size

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-05T06:16:00Z
Last change time
2013-05-04T04:19:16Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2013-04-05T06:16:11Z
--- struct S { @property size_t p(T)() { return 0; } } @property size_t p(T)() { return 0; } void main() { S s; auto n1 = p!int; // OK auto n2 = s.p!int; // OK auto a1 = new int[p!int]; // Error: need size of rightmost array, not type p!(int) auto a2 = new int[s.p!int]; // Error: no property 'p!(int)' for type 'S' } --- Workaround: Put property in parantheses: `new int[(p!int)]`.
Comment #1 by verylonglogin.reg — 2013-05-03T11:09:04Z
Looks like the second case is fixed with Issue 9946.
Comment #2 by k.hara.pg — 2013-05-04T00:16:20Z
Comment #3 by github-bugzilla — 2013-05-04T04:07:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/08e07564a879bf7abd904ddcc989eb2fff34fd54 fix Issue 9883 - Error on using property as new dynamic array size https://github.com/D-Programming-Language/dmd/commit/515ff959e04408bdebecca5c8e0c08ff6a69c8df Merge pull request #1964 from 9rnsr/fix9883 Issue 9883 - Error on using property as new dynamic array size