]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wunused-variable from <regex>
authorJonathan Wakely <jwakely@redhat.com>
Wed, 29 Oct 2025 21:37:18 +0000 (21:37 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 29 Oct 2025 21:41:12 +0000 (21:41 +0000)
In r16-4709-gc55c1de3a9adb2 I meant to use the result of the
static_cast<char> for the rest of the function following it, but I
accidentally used the original variable __ch. This causes
-Wunused-variable warnings for the __c initialized from the cast.

This fixes the rest of the function to use __c instead of __ch.

libstdc++-v3/ChangeLog:

* include/bits/regex.tcc (regex_traits::value): Use __c instead
of __ch.

libstdc++-v3/include/bits/regex.tcc

index a0edf272717e38c815c6d5ce2d767e743e618135..48917cdfda914b216d3f35ab250bb707a75a8bf2 100644 (file)
@@ -348,11 +348,11 @@ namespace __detail
        {
          const char __c = static_cast<char>(__ch);
          const char __max_digit = __radix == 8 ? '7' : '9';
-         if ('0' <= __ch && __ch <= __max_digit)
-           return __ch - '0';
+         if ('0' <= __c && __c <= __max_digit)
+           return __c - '0';
          if (__radix < 16)
            return -1;
-         switch (__ch)
+         switch (__c)
          {
            case 'a':
            case 'A':