fork download
  1. struct A
  2. {
  3. static const int value = 2;
  4. };
  5. const int A::value;
  6.  
  7. template <typename T>
  8. struct B
  9. {
  10. static const int value = sizeof(T);
  11. };
  12. template <typename T>
  13. const int B<T>::value;
  14.  
  15. #include <iostream>
  16.  
  17. int main()
  18. {
  19. std::cout << A::A::A::A::A::A::A::value << '\n';
  20. std::cout << ( B<char>::B::template B<int>::B::value ) << '\n';
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:20:32: error: ‘template’ (as a disambiguator) is only allowed within templates
prog.cpp:20:43: error: expected primary-expression before ‘int’
prog.cpp:20:43: error: expected ‘)’ before ‘int’
stdout
Standard output is empty