Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow destructors to throw when compiling in >= C++11 #767

Merged
merged 2 commits into from
Feb 13, 2017

Conversation

Peter-Levine
Copy link
Contributor

In C++11 and later, destructors are marked noexcept(true) by default. All throws become calls to terminate(). To enable the original intent of the throw, such destructors (and if virtual, those of its parent classes) need to be explicitly marked noexcept(false) when compiled in a dialect >= C++11.

Explicitly mark destructors that throw as "noexcept(false)" when compiling in a post C++11 dialect.
@sodabrew
Copy link
Member

sodabrew commented Feb 8, 2017

Thanks! Interesting change in C++11. Is it possible to macro this in one place, for example:

In a header file:

#if __cplusplus >= 201103L
#define NO_EXCEPT_FALSE noexcept(false)
#else
#define NO_EXCEPT_FALSE
#endif

Everywhere else:

Bindable_t::~Bindable_t()
NO_EXCEPT_FALSE
  {
  	BindingBag.erase (Binding);
  }

@sodabrew sodabrew added this to the v1.2.3 milestone Feb 8, 2017
@Peter-Levine
Copy link
Contributor Author

Peter-Levine commented Feb 8, 2017

Is it possible to macro this in one place...

Yeah. Updated it. Putting it in ext/binder.h works fine on my end.

@sodabrew sodabrew merged commit 64e04fe into eventmachine:master Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants