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

[inplace_function] make it usable without exceptions #152

Closed
AndWass opened this issue Mar 13, 2019 · 2 comments
Closed

[inplace_function] make it usable without exceptions #152

AndWass opened this issue Mar 13, 2019 · 2 comments

Comments

@AndWass
Copy link

AndWass commented Mar 13, 2019

The throw std::bad_function_call(); in the default constructor of vtable causes compilation failures when building with -fno-exceptions.

What to do instead, I don't really know, but one of the use-cases I have for this is in an embedded setting and this is throwing a wrench in that unfortunately.

@Quuxplusone
Copy link
Contributor

I suggest adding this to the top of the header:

#ifndef SG14_INPLACE_FUNCTION_THROW
#define SG14_INPLACE_FUNCTION_THROW(x) throw (x)
#endif

and then we use SG14_INPLACE_FUNCTION_THROW(std::bad_function_call()); in the vtable.

And if you don't want the throw, you just #define SG14_INPLACE_FUNCTION_THROW(x) __builtin_unreachable() or assert(false) or whatever.

@AndWass
Copy link
Author

AndWass commented Mar 13, 2019

Yah that sounds like a good solution.

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

No branches or pull requests

2 participants