Clang vs GCC vs оператор преобразования шаблонов MSVC - какой компилятор прав?

У меня есть простой код с оператором преобразования, и кажется, что все компиляторы дают разные результаты, было интересно, какой компилятор, если таковые имеются, является правильным? Я также пробовал разные комбинации, но ниже наиболее интересные. Код был скомпилирован с использованием флага C ++ 11, но такое же поведение может наблюдаться и в C ++ 03.

#include <iostream>

struct call_operator {
    template<typename T>
    operator T() {
        std::cout << __FUNCTION__ << std::endl;
        return {};
    }

    template<typename T>
    operator const T&() const {
        std::cout << __FUNCTION__ << std::endl;
        static T t;
        return t;
    }

    template<typename T>
    operator T&() const {
        std::cout << __FUNCTION__ << std::endl;
        static T t;
        return t;
    }
};

int main() {
    (void)static_cast<int>(call_operator());
    (void)static_cast<const int&>(call_operator());
    (void)static_cast<int&>(call_operator());
}

лязг-3,6:

operator int
operator const int &
operator int &

г ++ - 4,9:

operator T
operator const T&
operator T&

ОСАГО MSVC 2014:

call_operator.cpp(17): error C2440: 'static_cast': cannot convert from 'call_operator' to ' const int &'

после удаления:

template<typename T>
operator T();

msvc компилирует:

call_operator::operator const int &
call_operator::operator const int &
call_operator::operator int &

более того, после удаления констант в

template<typename T>
operator const T&();

лязг-3,6:

call_operator.cpp:26:9: error: ambiguous conversion for static_cast from 'call_operator' to 'int' (void)static_cast<int>(call_operator());

г ++ - 4,9:

operator T
operator const T&
operator T&

ОСАГО MSVC 2014:

call_operator.cpp(16): error C2440: 'static_cast': cannot convert from 'call_operator' to 'int'

Ответы на вопрос(1)

Ваш ответ на вопрос