fork download
  1. template <typename T>
  2. class base
  3. {
  4. public:
  5. typedef T booboo;
  6. };
  7.  
  8. template <typename T>
  9. class derived : public base<T>
  10. {
  11. public:
  12. //typedef typename base<T>::booboo booboo; <-- fixes the problem
  13. booboo boo()
  14. {
  15. booboo bb = T(1);
  16. return bb;
  17. }
  18. };
  19.  
  20. int main()
  21. {
  22. derived<int> d;
  23. d.boo();
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:13:4: error: ‘booboo’ does not name a type
prog.cpp:13:4: note: (perhaps ‘typename base<T>::booboo’ was intended)
prog.cpp: In function ‘int main()’:
prog.cpp:23:6: error: ‘class derived<int>’ has no member named ‘boo’
stdout

Standard output is empty