Bug 1202 – Dollar inside array literal inside index brackets is valid.

Status
RESOLVED
Resolution
INVALID
Severity
trivial
Priority
P4
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-04-29T16:15:00Z
Last change time
2014-02-16T15:23:58Z
Assigned to
bugzilla
Creator
aziz.koeksal

Comments

Comment #0 by aziz.koeksal — 2007-04-29T16:15:00Z
// writefln([1,2,$]); // '$' is valid only inside [] of index or slice writefln([1,2,3][0 .. [$][0]]); // [1,2,3] writefln([1,2,3][0 .. [0,$][1]]); // [1,2,3] writefln([1,2,3][0 .. [0,1,$][$-1]]); // [1,2,3] writefln([1,2,3][0 .. [0,1,$][$-$]]); // [] writefln([1,2,3][0 .. [$][$-$]]); // [1,2,3] writefln([1,2,3][0 .. $*[$][0]/$]); // [1,2,3] writefln([1,2,3][0 .. [$,[$][0]][0..$][0]]); // [1,2,3]
Comment #1 by bugzilla — 2007-06-30T19:53:52Z
It's valid because it is inside the [] of a slice for the [1,2,3].