-
Notifications
You must be signed in to change notification settings - Fork 363
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
Cannot compile with /GR- (RTTI disabled) and _HAS_STATIC_RTTI=0 with MSVC compiler #669
Comments
I think the We also might want to flip the conditions a little to better reflect the different possibilities you described. Need to think a little more |
I was under the impression that Your changes seem to have fixed the issue for me and it's correctly selecting the static cast now. |
I think I have always interpreted it as if that is set it has RTTI but don't use the dynamic RTTI. |
Actually on reflection, I think the value of that definition is taken into consideration, as implied by both these threads:
That said, your proposed change is still behaving correctly. CLI11 should be using the static cast if |
I get the following error compiling a CLI11 example with
/GR-
(RTTI disabled) and also with-D_HAS_STATIC_RTTI=0
:The condition check for whether to use a dynamic or static cast is the issue here:
CLI11/include/CLI/App.hpp
Lines 1546 to 1550 in 8155532
MSVC does not appear to modify the value of
__cpp_rtti
which remains1
, but rather sets_CPPRTTI
instead. Visual Studio's intellisense doesn't seem to correctly interpret this value but it does in fact change depending on/GR[-]
.If my understanding is correct, the condition for
_HAS_STATIC_RTTI
should also be checking for a value of1
, not0
.The text was updated successfully, but these errors were encountered: