<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54594>54594</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            libc++: Unable to build libcxx with newlib
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jupiter-zzp
      </td>
    </tr>
</table>

<pre>
    Cross build libcxx with newlib will raise error:
```
runtimes/include/c++/v1/__locale:552:5: error: static_assert failed due to requirement '(__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word' "__regex_word can't overlap other bits"
    static_assert((__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word,
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 warnings and 1 error generated.
```
The definitions for newlib are as below.
```
#elif defined(_NEWLIB_VERSION)
    // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
    typedef char mask;
    static const mask space  = _S;
    static const mask print  = _P | _U | _L | _N | _B;
    static const mask cntrl  = _C;
    static const mask upper  = _U;
    static const mask lower  = _L;
    static const mask alpha  = _U | _L;
    static const mask digit  = _N;
    static const mask punct  = _P;
    static const mask xdigit = _X | _N;
    static const mask blank  = _B;
    static const mask __regex_word = 0x80;
```

In newlib 4.1.0 the definitions are as below. So `blank` and `print` will overlap with `__regex_word`
```
#define _U      01
#define _L      02
#define _N      04
#define _S      010
#define _P      020
#define _C      040
#define _X      0100
#define _B      0200
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVktv4zYQ_jXyZbCGTEl-HHRYOwkQIHCLumn3JlDi2OIuLakkFTv76z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