A question I recently tried to answer seemed to be an error in vs2012's c++11 support.
Specifically, It failed to compile std::map with a non copy-constructible value_type, despite only std::move being used to insert into the map. Either the wrong insert overload is chosen, or the compiler doesn't consider the alternative.
Basically, I wan't to know if the following code:
#include <iostream>
#include <memory>
#include <utility>
#include <type_traits>
class Foo {
};
using namespace std;
int main() {
cout << is_constructible<pair<const int,unique_ptr<Foo> >, pair<const int,unique_ptr<Foo> >& >::value << '\n';
cout << is_constructible<pair<const int,unique_ptr<Foo> >, pair<const int,unique_ptr<Foo> >&& >::value << '\n';
}
gives the output 01.
Visual Studio
outputs(see it live):Which is clearly wrong and both
gcc
andclang
give the expected results. This bug and the original issue you are seeing may be related to these two accepted bug reports. The incorrect results from is_constructible may actually be unrelated to the original bug: