You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
finished using Backend
terminate called after throwing an instance of 'std::logic_error'
what(): Unknown term '1'
Aborted
I made an intentionally invalid call to the backend. When the Backend goes out of scope its destructor throws an exception, but I'm unable to catch it.
I might be missing something about what I could do differently, but when I search for information related to this I find advice that destructors should not throw exceptions.
The text was updated successfully, but these errors were encountered:
My colleague @mbalduccini figured out that a cause of the problem is that C+11 defaults all destructors to noexcept(true), and my program can be made to work (throw exception rather than terminating) if clingo.hh is modified to declare noexcept(false) as in:
~Backend() noexcept(false);
and also for ~SolveHandle and ~ProgramBuilder for good measure.
As far as I can tell this is still not recommended as it could cause a resource leak, but it's an improvement.
Example:
This prints:
I made an intentionally invalid call to the backend. When the Backend goes out of scope its destructor throws an exception, but I'm unable to catch it.
I might be missing something about what I could do differently, but when I search for information related to this I find advice that destructors should not throw exceptions.
The text was updated successfully, but these errors were encountered: