fork download
  1. template <typename T>
  2. struct A {
  3. struct B {
  4. };
  5. };
  6.  
  7. struct C {
  8. typedef A<C> D;
  9.  
  10. int f() {
  11. typename D::B p;
  12. return 0;
  13. }
  14. };
  15.  
  16. C gc;
  17. int x = gc.f();
  18.  
  19. template <>
  20. struct A<C> {
  21. struct B {
  22. B() {
  23. cout << "B::B()" << endl;
  24. }
  25.  
  26. ~B() {
  27. cout << "B::~B()" << endl;
  28. }
  29. };
  30. };
  31.  
  32. int main() {
  33. }
  34.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:20:8: error: specialization of 'A<C>' after instantiation
prog.cpp:20:8: error: redefinition of 'struct A<C>'
prog.cpp:2:10: error: previous definition of 'struct A<C>'
stdout

Standard output is empty