www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17226] New: Exception during the generation of an assert


          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 puremagic.com
          Reporter: acehreli 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() {


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.


Feb 25 2017