llvm / llvm/llvm-project

[libc++] Some compound assignment operators for bitmask types are not `constexpr` functions

Open
#172,979 1 comment 0 reactions 0 assignees View on GitHub
libc++
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

It's quite weird that some bitwise binary operators for bitmask types are `constexpr`, but the corresponding compound assignment operators are not.

For example:
https://github.com/llvm/llvm-project/blob/ad66b67fc596a98c94c392523dfad923444156a1/libcxx/include/__filesystem/copy_options.h#L37-L47
https://github.com/llvm/llvm-project/blob/ad66b67fc596a98c94c392523dfad923444156a1/libcxx/include/__filesystem/copy_options.h#L53-L63

I think these compound assignment operators should be marked either `_LIBCPP_CONSTEXPR_SINCE_CXX14` or `constexpr` (if only available in C++14 and later).

I submitted [LWG3977](https://cplusplus.github.io/LWG/issue3977) for this. But I believe we can add `constexpr` and `noexcept` even without that LWG issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.