On 2013-09-26 20:18, Gary Willoughby wrote:

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.");
}

I don't know which version of DMD you're using or when this part of druntime was update, but it's clearly not private according to the source code:

https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L380

--
/Jacob Carlborg

Reply via email to