[Issue 12501] Assertion `global.gaggedErrors || global.errors' failed.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 13 12:18:52 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12501

monarchdodra at gmail.com changed:

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

--- Comment #4 from monarchdodra at 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?

--


More information about the Digitalmars-d-bugs mailing list