Skip to content

Commit

Permalink
Fix more typeof expressions that were missed
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy committed Jun 5, 2015
1 parent ad1eeff commit c353c4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions std/range/primitives.d
Expand Up @@ -905,10 +905,10 @@ template isRandomAccessRange(R)

static if(is(typeof(r[$])))
{
static assert(is(typeof(r.front) == typeof(r[$])));
static assert(is(typeof(f) == typeof(r[$])));

static if(!isInfinite!R)
static assert(is(typeof(r.front) == typeof(r[$ - 1])));
static assert(is(typeof(f) == typeof(r[$ - 1])));
}
}));
}
Expand All @@ -932,12 +932,12 @@ unittest
// $ must work as it does with arrays if opIndex works with $
static if(is(typeof(r[$])))
{
static assert(is(typeof(r.front) == typeof(r[$])));
static assert(is(typeof(f) == typeof(r[$])));

// $ - 1 doesn't make sense with infinite ranges but needs to work
// with finite ones.
static if(!isInfinite!R)
static assert(is(typeof(r.front) == typeof(r[$ - 1])));
static assert(is(typeof(f) == typeof(r[$ - 1])));
}
}

Expand Down

0 comments on commit c353c4a

Please sign in to comment.