mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 07:30:33 +03:00
bug in reduce when passed const arguments
This commit is contained in:
parent
b50f21459c
commit
391ce8db1e
1 changed files with 11 additions and 1 deletions
|
@ -256,8 +256,9 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
E reduce(E, R)(E result, R r)
|
||||
Unqual!E reduce(E, R)(E seed, R r)
|
||||
{
|
||||
Unqual!E result = seed;
|
||||
foreach (e; r)
|
||||
{
|
||||
static if (fun.length == 1)
|
||||
|
@ -321,6 +322,15 @@ unittest
|
|||
assert(rep[2 .. $] == "1, 2, 3, 4, 5");
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
const float a = 0.0;
|
||||
const float[] b = [ 1.2, 3, 3.3 ];
|
||||
float[] c = [ 1.2, 3, 3.3 ];
|
||||
auto r = reduce!"a + b"(a, b);
|
||||
r = reduce!"a + b"(a, c);
|
||||
}
|
||||
|
||||
/**
|
||||
Fills a range with a value.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue