@@ -452,16 +452,18 @@ public:
452
452
#elif defined(_NEWLIB_VERSION)
453
453
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
454
454
typedef char mask;
455
- static const mask space = _S;
456
- static const mask print = _P | _U | _L | _N | _B;
457
- static const mask cntrl = _C;
458
- static const mask upper = _U;
459
- static const mask lower = _L;
460
- static const mask alpha = _U | _L;
461
- static const mask digit = _N;
462
- static const mask punct = _P;
463
- static const mask xdigit = _X | _N;
464
- static const mask blank = _B;
455
+ // In case char is signed, static_cast is needed to avoid warning on
456
+ // positive value becomming negative.
457
+ static const mask space = static_cast <mask>(_S);
458
+ static const mask print = static_cast <mask>(_P | _U | _L | _N | _B);
459
+ static const mask cntrl = static_cast <mask>(_C);
460
+ static const mask upper = static_cast <mask>(_U);
461
+ static const mask lower = static_cast <mask>(_L);
462
+ static const mask alpha = static_cast <mask>(_U | _L);
463
+ static const mask digit = static_cast <mask>(_N);
464
+ static const mask punct = static_cast <mask>(_P);
465
+ static const mask xdigit = static_cast <mask>(_X | _N);
466
+ static const mask blank = static_cast <mask>(_B);
465
467
// mask is already fully saturated, use a different type in regex_type_traits.
466
468
static const unsigned short __regex_word = 0x100 ;
467
469
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
0 commit comments