Make EnumClassBitmask's BoolConvertible constructor explicit.
The implicit constructor seemed to confuse MSVC 14.29 when it tries to find overloads of == or != with bitmasks. It didn't help fix compilation but at least it's cleaner. Bug: None Change-Id: I40d9f831701113d021fc40862657a28f359d1ced Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117887 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:
parent
46d7c5e064
commit
40358fde0b
|
@ -53,7 +53,7 @@ struct BoolConvertible {
|
|||
using Integral = typename std::underlying_type<T>::type;
|
||||
|
||||
// NOLINTNEXTLINE(runtime/explicit)
|
||||
constexpr BoolConvertible(Integral value) : value(value) {}
|
||||
explicit constexpr BoolConvertible(Integral value) : value(value) {}
|
||||
constexpr operator bool() const { return value != 0; }
|
||||
constexpr operator T() const { return static_cast<T>(value); }
|
||||
|
||||
|
@ -74,8 +74,8 @@ template <
|
|||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
||||
}
|
||||
|
||||
template <
|
||||
|
@ -85,8 +85,8 @@ template <
|
|||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
||||
}
|
||||
|
||||
template <
|
||||
|
@ -96,15 +96,15 @@ template <
|
|||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right));
|
||||
return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
|
||||
static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
|
||||
}
|
||||
|
||||
template <typename T1>
|
||||
constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
|
||||
using T = typename LowerBitmask<T1>::type;
|
||||
using Integral = typename std::underlying_type<T>::type;
|
||||
return ~static_cast<Integral>(LowerBitmask<T1>::Lower(t));
|
||||
return BoolConvertible<T>(~static_cast<Integral>(LowerBitmask<T1>::Lower(t)));
|
||||
}
|
||||
|
||||
template <
|
||||
|
|
Loading…
Reference in New Issue