On Wednesday, 25 September 2013 at 21:00:00 UTC, Jacob Carlborg wrote:
There are property functions at line 374 and below to set the assert handler.

Only the deprecated version works as expected.

import core.exception;
import std.stdio;

alias void function(string file, size_t line, string msg) AssertHandler;

AssertHandler handler = function(string file, size_t line, string msg)
{
        writefln("File: %s", file);
        writefln("Line: %s", line);
        writefln("Message: %s", msg);
};

void main(string[] args)
{
        // assertHandler = handler; // <--- Private!
        setAssertHandler(handler); // <--- Works but deprecated

        assert(false, "Test message.");
}

Reply via email to