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

warning C4127: conditional expression is constant #60

Closed
matbech opened this issue May 20, 2022 · 0 comments · Fixed by #61
Closed

warning C4127: conditional expression is constant #60

matbech opened this issue May 20, 2022 · 0 comments · Fixed by #61

Comments

@matbech
Copy link
Contributor

matbech commented May 20, 2022

I get the following warning with VS 2022 17.3

1>C:\Projects\Libraries\scnlib\scnlib\src\locale.cpp(311,9): warning C4127: conditional expression is constant
1>C:\Projects\Libraries\scnlib\scnlib\src\locale.cpp(311,9): message : consider using 'if constexpr' statement instead
1>C:\Projects\Libraries\scnlib\scnlib\src\locale.cpp(311): message : while compiling class template member function 'bool scn::v1::detail::basic_custom_locale_ref<char>::is_alnum(scn::v1::span<const char>) const'
1>C:\Projects\Libraries\scnlib\scnlib\src\locale.cpp(538): message : see reference to class template instantiation 'scn::v1::detail::basic_custom_locale_ref<char>' being compiled

The fix is to replace several occurrences of:
if (sizeof(CharT) == 1) {
with
if constexpr (sizeof(CharT) == 1) {

PR: #61

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

Successfully merging a pull request may close this issue.

1 participant