[libcxx-commits] [PATCH] D118188: [libcxx] [Windows] Pick a unique bit for __regex_word
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 28 08:34:21 PST 2022
mstorsjo added inline comments.
================
Comment at: libcxx/include/__locale:548
_LIBCPP_INLINE_VISIBILITY ctype_base() {}
};
----------------
muiez wrote:
> 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.
Yep, I added parentheses in that form in the updated patch. But that assert fails on AIX in the precommit testing.
The second assert fails on windows too, so I didn’t include it in the patch.
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