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.