fork download
  1. #include <iostream>
  2.  
  3. struct cls {
  4. using type = double; //case 1
  5. // typedef double type; //case 2
  6. };
  7.  
  8. template<typename T>
  9. void foo(typename T::type) {
  10. std::cout<<"T::type\n";
  11. }
  12.  
  13. int main() {
  14. foo<cls>(22.2);
  15. }
Compilation error #stdin compilation error #stdout 0s 2728KB
stdin
Standard input is empty
compilation info
prog.cpp:4: error: expected nested-name-specifier before 'type'
prog.cpp:4: error: using-declaration for non-member at class scope
prog.cpp:4: error: expected `;' before '=' token
prog.cpp:4: error: expected unqualified-id before '=' token
prog.cpp: In function 'int main()':
prog.cpp:14: error: no matching function for call to 'foo(double)'
stdout
Standard output is empty