jarro2783 / cxxopts

Lightweight C++ command line option parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting a sign-conversion warning/error with clang 14 and CXXOPTS_USE_UNICODE_HELP ON

tanja84dk opened this issue · comments

Just wanna inform that I'm receiving a sign-conversion warning/error about when ever I build with CXXOPTS_USE_UNICODE_HELP ON on clang 14
It gives no warnings as soon as I don't build with the CXXOPTS_USE_UNICODE_HELP OFF
The version I'm using is the 3.1.1 from releases.
compiled with "-g -Werror -Wall -Wextra -pedantic -Wconversion -Wundef -Wshadow -Wno-gnu-zero-variadic-macro-arguments -Wzero-as-null-pointer-constant -std=gnu++20"

It looks like its because legth actually is returning a int32_t and not size_t so it looks like change from signed to unsigned within the defined CXXOPTS_USE_UNICODE in the std::size_t stringLength function.

[build] /home/buildclient/.cache/CPM/cxxopts/34ea97fde3ca260fa6ad09943fe241d2af50025c/cxxopts/include/cxxopts.hpp:236:12: error: implicit conversion changes signedness: 'int32_t' (aka 'int') to 'std::size_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
[build]   return s.length();
[build]   ~~~~~~ ~~^~~~~~~~
[build] 1 error generated.

Thanks, I'll take a look at that one.

Can confirm that the error/warning has disappeared with the changes there has been made to master

Tried to build 120205a still with "CXXOPTS_USE_UNICODE_HELP ON" and also with "CXXOPTS_BUILD_EXAMPLES ON" just to test and the build succeeded with no warnings or errors