https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103305
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This should work:
--- a/libstdc++-v3/config/os/newlib/ctype_base.h
+++ b/libstdc++-v3/config/os/newlib/ctype_base.h
@@ -41,6 +41,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
typedef char mask;
+#if defined _U && defined _L && defined _N && defined _S
static const mask upper = _U;
static const mask lower = _L;
static const mask alpha = _U | _L;
@@ -52,6 +53,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static const mask cntrl = _C;
static const mask punct = _P;
static const mask alnum = _U | _L | _N;
+#else
+ static const mask upper = _ISupper;
+ static const mask lower = _ISlower;
+ static const mask alpha = _ISupper | _ISlower;
+ static const mask digit = _ISdigit;
+ static const mask xdigit = _ISxdigit | _ISdigit;
+ static const mask space = _ISspace;
+ static const mask print = _ISpunct | _ISupper | _ISlower | _ISdigit |
_ISblank;
+ static const mask graph = _ISpunct | _ISupper | _ISlower | _ISdigit;
+ static const mask cntrl = _IScntrl;
+ static const mask punct = _ISpunct;
+ static const mask alnum = _ISupper | _ISlower | _ISdigit;
+#endif
#if __cplusplus >= 201103L
static const mask blank = space;
#endif
But of course we can't fix already-released versions.