[libcxx-commits] [PATCH] D118188: [libcxx] [Windows] Pick a unique bit for __regex_word

Muiez Ahmed via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 28 08:23:09 PST 2022


muiez added inline comments.


================
Comment at: libcxx/include/__locale:548
     _LIBCPP_INLINE_VISIBILITY ctype_base() {}
 };
 
----------------
mstorsjo wrote:
> Quuxplusone wrote:
> > Could we realistically put a future-proofing `static_assert` down here, something like
> > ```
> > static_assert(__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank) == __regex_word);
> > ```
> > and I would expect
> > ```
> > static_assert(upper | lower == alpha);
> > ```
> > also? And/or, could we make a test for this?
> I guess such a `static_assert` for `__regex_word` would be good to have, yes.
> 
> `static_assert(upper | lower == alpha);` doesn't hold on Windows, `_ALPHA` is defined as `0x0100 | _UPPER | _LOWER` actually.
On z/OS, the following static_assert passes:

```
    static_assert((__regex_word & ~(space | print | cntrl | upper | lower | alpha | digit | punct | xdigit | blank)) == __regex_word);
```
However, this one fails:

```
static_assert((upper | lower) == alpha);
```

Note: we should place parentheses around the | expression to evaluate it first since == has a higher precedence. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118188/new/

https://reviews.llvm.org/D118188



More information about the libcxx-commits mailing list