Proposal 2: Exceptions and @nogc

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 11 01:54:22 PDT 2017


On Tuesday, April 11, 2017 01:05:10 Walter Bright via Digitalmars-d wrote:
> On 4/10/2017 6:41 AM, Andrew Godfrey wrote:
> > I'm just curious: The proposal doesn't mention interop with C++
> > exception
> > handlers. I don't know the status of that so I'll just ask: Can C++ code
> > catch D exceptions?
>
> No. D can catch C++ exceptions.

What does this look like? I recall you discussing planning adding the
ability for D to catch C++ exceptions, but I was unaware that it had been
implemented yet. Certainly, I couldn't find it in the documentation when I
went looking a month or two back. But I wouldn't think that catching
Exception would work if it's a C++ exception - even if it's a
std::exception, since std::exception doesn't have the same functions as
Exception or Throwable. So, how would you catch a C++ exception in D?

- Jonathan M Davis



More information about the Digitalmars-d mailing list