www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14465] New: CTFE exception stacktrace shows location of

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

          Issue ID: 14465
           Summary: CTFE exception stacktrace shows location of Exception
                    constructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
class E : Exception
{
    this(string msg)
    {
        super(msg);
    }
}

bool foo()
{
    throw new E("message");
}

static assert(foo());
CODE

dmd -c bug
----
bug.d(5): Error: uncaught CTFE exception bug.E("message")
bug.d(11):        thrown from here
bug.d(14):        called from here: foo()
bug.d(14):        while evaluating: static assert(foo())
----

The first line shouldn't be present in the stacktrace, b/c that's code
constructing the exception, which happens before the exception is thrown.

--
Apr 19 2015