-
Notifications
You must be signed in to change notification settings - Fork 39
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
Non default constructible object is created and returned, somehow #42
Comments
I think I found the problem. In call_impl, the function stored in the vtable is reinterpret casted like this: struct SimpleCall {
constexpr inline int run() {
return te::call<int>([](auto &self) { return std::string{"not an int"}; }, *this);
}
}; That seems dangerous to me... I also don't understand why |
Thanks for your investigation @fabiorossetto and for sharing your findings. I'm pretty sure there should be static assert there to ensure that the cast is valid, likely should be a bit_cast in c++20 too. I will add it as indeed its dangerous as it is. Regarding the result type in call, that's required as the lambda takes template arguments which are known later on, otherwise the deduction could fail if poked with wrong types similary to std::invoke. |
@krzysztof-jusiak I'd be happy to contribute to the project. I can understand almost all the code, but there are certain parts I cannot follow. In order for me to push a fix I'd need some support with understanding certain parts of the code. Let me know if you'd be interested in receiving external support with the project! |
Hi @fabiorossetto . Would absolutely love it and will do my best to help. Thank you! |
@krzysztof-jusiak Thank you Krys. Let me know if there is any way I can write you in private with my questions |
Sure, feel free to drop me a line at [email protected]. Thanks. |
Expected Behavior
See the attached minimal reproducible example. SimpleCall returns an object of type
NoDefaultCtor
. Somehow, the code compiles. This doesn't make sense because how canNoDefaultCtor
be constructed.value
, which should be 7, is 0 instead.Actual Behavior
Steps to Reproduce the Problem
Specifications
Tried on clang 16.0.0 and GCC 10
The text was updated successfully, but these errors were encountered: