-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
With the small parameterized example (https://godbolt.org/z/rbETf6PfK)
int main() {
using namespace boost::ut;
"args and types"_test =
[]<class TArg>(const TArg& arg) {
expect(std::is_integral_v<TArg> >> fatal);
expect(42_i == arg or "is true"_b == arg);
expect(type<TArg> == type<int> or type<TArg> == type<bool>);
}
| std::tuple{true, 42};
}I got
/app/raw.githubusercontent.com/boost-experimental/ut/master/include/boost/ut.hpp:1015:29: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
1015 | return get(lhs) == get(rhs);
| ~~~~~~~~~^~~~~~~~~~~
/app/raw.githubusercontent.com/boost-experimental/ut/master/include/boost/ut.hpp:2607:34: note: candidate 1: 'constexpr auto boost::ext::ut::v2_3_1::literals::operator""_b(const char*, long unsigned int)::named::operator==(bool) const'
2607 | [[nodiscard]] constexpr auto operator==(const bool other) const {
| ^~~~~~~~
/app/raw.githubusercontent.com/boost-experimental/ut/master/include/boost/ut.hpp:1015:29: note: candidate 2: 'operator==(int, int)' (built-in)
1015 | return get(lhs) == get(rhs);
| ~~~~~~~~~^~~~~~~~~~~
But if I static_cast the _b literal type into bool (bool("is true"_b) == arg, the warning is removed.
Is it a problem of definition, or visibility?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels