Thread overview
[Issue 12501] Assertion `global.gaggedErrors || global.errors' failed.
Apr 15, 2014
Kenji Hara
April 13, 2014
https://issues.dlang.org/show_bug.cgi?id=12501

monarchdodra@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |monarchdodra@gmail.com
         Resolution|FIXED                       |---

--- Comment #4 from monarchdodra@gmail.com ---
Was this fixed? I can reproduce it with this case:

//----
void main()
{
    import std.algorithm: min, max, reduce;
    import std.typecons: tuple;
    dchar c = 'a';
    reduce!(min, max)(tuple(c, c, c), "hello"); // OK
}
//----
dmd: statement.c:713: ErrorStatement::ErrorStatement(): Assertion
`global.gaggedErrors || global.errors' failed.
Aborted (core dumped)
//----

Or, reduced to:
//----
import std.traits, std.functional;

template reduce(fun...)
{
    auto reduce(Seed)(Seed result)
    {
        foreach (i, Unused; Seed.Types)
           result[i] = binaryFun!(fun[i])(1, 1); //Here
        return result;
    }
}

void main()
{
    import std.typecons: tuple;
    reduce!("a", "a")(tuple(1, 1, 1));
}
//----

I think the root issue is in:
result[i] = binaryFun!(fun[i])(1, 1); //Here

Changing to either:
auto a = binaryFun!(fun[i])(1, 1);
or
result[i] = fun[i](1, 1);

Allows it to "fail correctly"

...

Or is it a different issue?

--
April 13, 2014
https://issues.dlang.org/show_bug.cgi?id=12501

--- Comment #5 from monarchdodra@gmail.com ---
(In reply to monarchdodra from comment #4)
> Was this fixed? I can reproduce it with this case:

Bearophile filed at as its own issue: https://issues.dlang.org/show_bug.cgi?id=12569

Don't know which you'd rather close (eg: deplicate, or leave this as fixed).

--
April 13, 2014
https://issues.dlang.org/show_bug.cgi?id=12501

--- Comment #6 from monarchdodra@gmail.com ---
(In reply to monarchdodra from comment #4)
> Was this fixed? I can reproduce it with this case:

Bearophile filed at as its own issue: https://issues.dlang.org/show_bug.cgi?id=12574

Don't know which you'd rather close (eg: deplicate, or leave this as fixed).

--
April 15, 2014
https://issues.dlang.org/show_bug.cgi?id=12501

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> ---
(In reply to monarchdodra from comment #6)
> (In reply to monarchdodra from comment #4)
> > Was this fixed? I can reproduce it with this case:
> 
> Bearophile filed at as its own issue: https://issues.dlang.org/show_bug.cgi?id=12574
> 
> Don't know which you'd rather close (eg: deplicate, or leave this as fixed).

I opened new compiler PR to fix issue 12574.

--