mardi 31 mars 2015

Consider the code



#include <vector>

int main()
{
std::vector<const int> vec;
}


According to Does C++11 allow vector<const T>? the code should not compile, even if in C++11 the vector elements are not required any more to be copy-assignable (now it only seems to be a requirement on the allocator). g++4.9 and g++5 reject the code, however clang (LLVM 3.5) merrily compiles it, with no warnings whatsoever.


I am not an expert in the standard, and would like to know what is the correct behaviour here?


Aucun commentaire:

Enregistrer un commentaire