[Issue 17226] New: Exception during the generation of an assert message hides AssertError

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 25 22:26:13 PST 2017


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

          Issue ID: 17226
           Summary: Exception during the generation of an assert message
                    hides AssertError
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

The following program fails an assertion. However, not the more important
AssertError but a measly Exception is thrown instead:

import std.string;

void foo(int i) {
    // In this case a %s is forgotten but it could be any other trivial error.
    assert(i == 42, format("Bad parameter:", i));
}

void main() {
    foo(43);
}

Output:

std.format.FormatException@ [...] Orphan format arguments: args[0..1]

I think this is a critical issue because the program could have caught the
Exception and continue unawares of the most important AssertError.

Ali

--


More information about the Digitalmars-d-bugs mailing list