-
Notifications
You must be signed in to change notification settings - Fork 88
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
Undefined sanitizer triggered about downcasting #1655
Comments
I can reproduce this behavior, but I am willing to say that this is not UB - this is a A more in-depth discussion of the same question: https://stackoverflow.com/questions/73172193/can-you-static-cast-this-to-a-derived-class-in-a-base-class-constructor-then-u |
Thanks for taking the time to look at it. I will follow the discussion on google/sanitizers. I agree that it may not be a UB but isn't it fragile ? In your example, |
It definitely depends on the order of base classes, but in our case, it would fail very loudly because it will lead to an uninitialized |
Hello, the following C++ snippet triggers the undefined sanitizer:
The sanitizer reports
It was compiled with the following
CMakeLists.txt
using the cmake command
cmake -B build -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=undefined -fno-omit-frame-pointer"
Thanks,
Thomas
The text was updated successfully, but these errors were encountered: