Fix MSVC 14.29 errors:

- It doens't know which operator == to use when there is using
 EnumClassBitmask that looks like (a & b) == 0. Instead use just
 the form (a & b).
 - It doesn't do automatic capture of constexpr variables in lambdas so
 turn a couple constexpr into regular const.
 - It (correctly) warns that if constexpr (std::is_constant_evaluated())
 is always true, so remove the constexpr keyword.

 Bug: None

Change-Id: If7857abd1c30acb0736557844ff13f32a19d54cf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117888
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2023-01-30 14:49:27 +00:00
committed by Dawn LUCI CQ
parent 40358fde0b
commit 97ad405216
8 changed files with 14 additions and 14 deletions

View File

@@ -1854,7 +1854,7 @@ ConstEval::Result ConstEval::OpShiftRight(const type::Type* ty,
using NumberT = decltype(e1);
using T = UnwrapNumber<NumberT>;
using UT = std::make_unsigned_t<T>;
constexpr size_t bit_width = BitWidth<NumberT>;
const size_t bit_width = BitWidth<NumberT>;
const UT e1u = static_cast<UT>(e1);
const UT e2u = static_cast<UT>(e2);

View File

@@ -112,8 +112,8 @@ struct PreservePadding::State {
//
// Since this requires passing pointers to the storage address space, this will also enable
// the chromium_experimental_full_ptr_parameters extension.
constexpr const char* kDestParamName = "dest";
constexpr const char* kValueParamName = "value";
const char* kDestParamName = "dest";
const char* kValueParamName = "value";
auto call_helper = [&](auto&& body) {
EnableExtension();
auto helper = helpers.GetOrCreate(ty, [&]() {

View File

@@ -46,7 +46,7 @@ inline constexpr uint32_t Log2(uint64_t value) {
#elif defined(_MSC_VER) && !defined(__clang__) && __cplusplus >= 202002L // MSVC and C++20+
// note: std::is_constant_evaluated() added in C++20
// required here as _BitScanReverse64 is not constexpr
if constexpr (!std::is_constant_evaluated()) {
if (!std::is_constant_evaluated()) {
// NOLINTNEXTLINE(runtime/int)
if constexpr (sizeof(unsigned long) == 8) { // 64-bit
// NOLINTNEXTLINE(runtime/int)