On Thursday, 22 October 2015 at 01:19:19 UTC, Andrei Alexandrescu
wrote:
Great news! What's the story on exceptions? Does Calypso allow
D code to catch exceptions thrown from C++ code? -- Andrei
Small update: the LDC 0.16.1 merge was done and it's now possible
to catch about any C++ exception with catch (C++) (..) {..}
statements.
https://github.com/Syniurge/Calypso/blob/master/tests/calypso/eh/std_exception.d
Output:
Throwing an ooops exception
Catching the ooops, e.what() == Ooops!
Throwing another ooops exception
Catching the std::exception, e.what() == Ooops!
Now throwing a float
Catching the float, f == 20.160000!
What's left to implement for full C++ EH support:
- catching class/struct by value (it's already possible to catch
thrown class values by reference though)
- thrown object lifetime
- rethrowing