Recently, upon updating a library to Clang 5.x, I noticed a bug in my code that had compiled previously on Clang 4.x, GCC 5.x-6.x, and MSVC 2015 and 2017.
#include <iostream>
#include <typeinfo>
#include <vector>
int main()
{
using a = typename std::vector<int>::vector;
std::cout << typeid(a).name() << std::endl;
return 0;
}
Clang-5.x produces the following warning message, while all other compilers silently compile the above code:
a.cpp:7:42: warning: ISO C++ specifies that qualified reference to 'vector' is a
constructor name rather than a type in this context, despite preceding
'typename' keyword [-Winjected-class-name]
using a = typename std::vector<int>::vector;
Which compiler is buggy? Am I correct in assuming that Clang5.x has the correct behavior here, and all the other compilers (and versions) are incorrect. If so, is this worth submitting bug reports to MSVC and GCC?