https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33041
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2016-05-07 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |4.5.3, 4.8.3, 4.9.3, 5.3.0, | |6.1.0 --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirming for the compilation error mentioned in comment #4. The latest trunk (7.0) fails to compile the test case with the errors below. (Both Clang and the EDG front end accept the code.) $ cat x.cpp && gcc -Wall -Wextra -Wpedantic x.cpp struct bar { typedef bar type; template <typename A> struct foo { static const int value = 2; }; }; template <typename B> struct foo: bar { static const int value = 1; }; int main() { // foo<int> is the foo struct at namespace level, foo<double> // should be the foo struct within bar, but it is not in g++ __builtin_printf ("%i\n", foo<int>::foo<double>::value); // foo<int> is again the foo struct at namespace level, // ::type explicitly takes its superclass so foo<double> is // the foo struct within bar. __builtin_printf ("%i\n", foo<int>::type::foo<double>::value); } x.cpp: In function ‘int main()’: x.cpp:14:43: error: expected primary-expression before ‘double’ __builtin_printf ("%i\n", foo<int>::foo<double>::value); ^~~~~~