As expected, the following code does not compile.
#include <type_traits>
#include <utility>
int main()
{
using T = std::pair<const int, int>;
const auto ok = std::is_assignable<T, T>::value; // true
T x;
T y;
x = y; // compiler error
}
But the value of ok
is true with the following three compilers.
- g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
- clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
- MSVC++ 2017 15.2 26430.6
Why is this?