https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116942
Bug ID: 116942 Summary: Behavior of std::regex compilation of character ranges inconsistent based on char type Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ddolan at lutron dot com Target Milestone: --- When compiling a regular expression that defines a character range using hexadecimal values greater than 0x7F, a std::regex_error is thrown if the char type of the target platform is signed. This exception is not thrown if the char type is unsigned. This behavior can similarly be turned on and off by providing -fsigned-char and -funsigned-char respectively, regardless of the target platform. The expectation is that this library would behave the same regardless of platform. I have confirmed that this example behaves as expected when using boost::regex with both char type configurations. See the attached preprocessed file that triggers this behavior. Output of gcc -v: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-linux-gnu/14.2.0/lto-wrapper Target: aarch64-linux-gnu Configured with: /usr/src/gcc/configure --build=aarch64-linux-gnu --disable-multilib --enable-languages=c,c++,fortran,go Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.0 (GCC) Command line used: g++ -std=c++17 -fsigned-char -o main main.cpp Compiler output: None