Есть код. Это просто минимизация на которой видна проблема:
#include <type_traits>
template<typename type_t>
inline constexpr bool is_bool_v = std::is_same_v<std::remove_cv_t<type_t>, bool>;
struct A
{
template<typename type_t, std::enable_if_t<is_bool_v<type_t>, int> = 0>
operator type_t() const;
template<typename type_t>
type_t get() const;
};
template<typename type_t, std::enable_if_t<is_bool_v<type_t>, int>>
inline A::operator type_t() const
{
return type_t();
}
template<typename type_t>
type_t A::get() const
{
return A::operator type_t();
}
int main()
{
A a;
const bool b = a.get<bool>();
return 0;
}
Допустим у класса 'A' нужно реализовать метод get(), который сам вызывает оператор преобразования типа. clang и gcc без проблем компилируют этот код, но msvc выдает ошибку: 'error C3861: 'operator bool': identifier not found'
Не пойму в чём проблема, кто прав и что делать?