Skip to content

Commit

Permalink
Merge pull request #6331 from jmdavis/revert
Browse files Browse the repository at this point in the history
Revert fix for 18631.
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
  • Loading branch information
dlang-bot committed Mar 23, 2018
2 parents 805914b + 5d6d784 commit 4b166f3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions std/random.d
Expand Up @@ -2074,8 +2074,7 @@ Returns:
return a `ref` to the $(D range element), otherwise it will return
a copy.
*/
auto ref inout(ElementType!Range) choice(Range, RandomGen = Random)(inout auto ref Range range,
ref RandomGen urng)
auto ref choice(Range, RandomGen = Random)(auto ref Range range, ref RandomGen urng)
if (isRandomAccessRange!Range && hasLength!Range && isUniformRNG!RandomGen)
{
assert(range.length > 0,
Expand Down Expand Up @@ -2112,13 +2111,6 @@ auto ref choice(Range)(auto ref Range range)
"Choice did not return a valid element from the given Range");
}

@safe unittest // issue 18631
{
const a = [0,1,2];
auto r = choice(a);
auto s = choice(cast(const)[0,1,2]);
}

@safe unittest
{
import std.algorithm.searching : canFind;
Expand Down

0 comments on commit 4b166f3

Please sign in to comment.