[Issue 10989] New: [CTFE] Uncaught exception messages are not pretty printed if message wasn't literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 7 15:41:00 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10989

           Summary: [CTFE] Uncaught exception messages are not pretty
                    printed if message wasn't literal
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-09-07 15:40:59 PDT ---
import std.string;

enum foo = (){ 
    throw new Exception(format("Something %d wicked happened!", 42));
    return 0;
}();

On a recent DMD from git master:

D:\D\ctfe_ex.d(4): Error: Uncaught CTFE exception object.Exception(['S', 'o',
'm', 'e', 't', 'h', 'i', 'n', 'g', ' ', '4', '2', ' ', 'w', 'i', 'c', 'k', 'e',
'd', ' ', 'h', 'a', 'p', 'p', 'e', 'n', 'e', 'd', '!'][0u..29u])
D:\D\ctfe_ex.d(6):        called from here: (*int()

{

throw new Exception(format("Something %d wicked happened!", 42),
"D:\\D\\ctfe_ex.d", 4u, null);

return 0;

}

Note that the following using plain literal neatly formats the string:

enum foo = (){ 
    throw new Exception("Something wicked happened!");
    return 0;
}();

D:\D\ctfe_ex.d(2): Error: Uncaught CTFE exception object.Exception("Something
wicked happened!")

The point is it should always pretty print it unless it contains bad UTF-8.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list