Bug 10033 – Wrong example in chapter Vector Extensions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-05T11:23:00Z
Last change time
2014-04-23T00:12:05Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
kai
Comments
Comment #0 by kai — 2013-05-05T11:23:50Z
In the Language Reference, chapter Vector Extensions, section Accessing Individual Vector Elements:
The 3rd example
cast(int[4])v[3] = 2;
does not compile. You have to add parenthesis to compile:
(cast(int[4])v)[3] = 2;
(According to TDPL, [] has a higher precedence then cast(). The compile error is therefore correct.)
Comment #1 by andrej.mitrovich — 2014-04-22T23:10:32Z