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
Overloaded function calling wrong version, in release mode only #900
Comments
Sounds like the safeties are getting turned off in Release mode and you're getting any-old-matching, because strict checking is disabled. |
How do I change that? The function this is being called from within is being executed using lua_pcall(). |
It looks like this code has an example of the sol way to replace lua_pcall, and from what I gather, the sol calling methods add the safety checks in(?): Do I need to not use lua_pcall? Is there another replacement for lua_pcall? |
I replaced the call to lua_pcall with this code but the problem persists!
|
I defined SOL_ALL_SAFETIES_ON = 1 and an error is occurring when the above code is run, but I don't know how to catch the error and print it out.
|
Okay, I have error handling working now. It says that no overload of the function was found with the given arguments, but I know it is there.
|
I found one way to write the function that works correctly in release mode:
I am using strict checks for everything except floating points / integers:
It is pretty dangerous to have these types of errors occurring. Any ideas how this can be detected better? |
After deep investigation, this seems like a SERIOUS bug in Visual C++. In release builds, it is selecting the wrong template function and this is extremely concerning to me that it is doing this despite there not being an ODR violation that I can find. I will need to spend more time looking into this and possibly producing a repro for the VC++ team, or finding out if there is some deeper bug in my code. I can't guarantee I will get back to you quickly, as I have spent a lot of my time just to confirm Visual C++ might be behaving poorly... |
@ThePhD |
Well, the docs there make it easy to see why RelWithDebInfo builds don't show the problem and only strictly release builds... Goddamn I spent days tracking this. Thanks for the tip @stonedreamforest |
Specifying This is a Visual C++ bug. Nothing I can do to help you here, @JoshKlint ; either write the function different or turn it off.
|
Wow, that is interesting. I also lost a couple days on this trying to figure out what was going on. My program works now with the original commands, with the fix above. Thank you! |
hi @ThePhD |
I have a problem with this overload:
In debug mode it works as expected. In release mode, the first function is always called, even though the parameter calls for the second overload. This was quite difficult to track down. What is going on here?
Both the GUI and Widget class are derived from a base Object class.
The text was updated successfully, but these errors were encountered: