Consider the following c++ program: class A { protected: int x; }; template<typename X> using B = A; template<typename T> class C : public B<T> { public: void f() { x = 0; } }; int main() { } Compile it with "-std=c++17 -pedantic-errors". Expected behaviour: Since the base class is not dependent (see http://wg21.link/cwg1390 ) the name lookup of x should succeed and no error message should be outputed during the compilation. Observed behaviour: An compilation error about failing the name lookup of x was outputed during the compilation. GCC is correctly compiling the program with no error messages outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435
Also see the following stack overflow post: https://stackoverflow.com/questions/63761866/difference-in-behaviour-between-clang-and-gcc-when-trying-to-confuse-them-by-usi
Correction to my first comment: "GCC is correctly compiling the program with no error messages outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435" should be: "Clang is correctly rejecting the program with a error message outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435"
Confirmed. Note I suspect the reason why it worked in GCC 5 was because there was some rewrite in GCC 6 to correct aliases.
DR1390 is still not resolved.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
GCC 10 branch is being closed.