fork download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. struct Base
  5. {
  6. using Type = int;
  7. };
  8.  
  9. template <typename T>
  10. struct intermediate : Base<T>
  11. {
  12. // using Type = typename intermediate<T>::Type; // Not needed
  13. };
  14.  
  15. template <typename T>
  16. struct Derived : intermediate<T>
  17. {
  18. using Type = intermediate<T>::Type;
  19. };
  20.  
  21. int main()
  22. {
  23. Derived<void>::Type b = 1;
  24. std::cout << b << std::endl;
  25. }
Compilation error #stdin compilation error #stdout 0s 16064KB
stdin
Standard input is empty
compilation info
prog.cpp:18:19: error: need ‘typename’ before ‘intermediate<T>::Type’ because ‘intermediate<T>’ is a dependent scope
     using Type =  intermediate<T>::Type;
                   ^~~~~~~~~~~~~~~
stdout
Standard output is empty