fork download
  1. template<typename T, typename S>
  2. class Enclosing{
  3. public:
  4. class Nested;
  5. Nested foo();
  6. };
  7.  
  8. template<typename T, typename S>
  9. class Enclosing<T,S>::Nested{
  10. public:
  11. T field;
  12. void some_method();
  13. friend class Enclosing; // instead of this line I also tried:
  14. // friend class Enclosing<T,S>
  15. // and it didn't work either
  16. };
  17.  
  18. template<typename T, typename S>
  19. typename Enclosing<T,S>::Nested Enclosing<T,S>::foo (){
  20. Nested nes;
  21. nes.some_method(); // the problem appears here
  22. return nes;
  23. }
Compilation error #stdin compilation error #stdout 0s 2848KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty