fork download
  1. struct Foo{};
  2. struct Bar{};
  3.  
  4. /////////////////////////////////////////////////////////////////////////////
  5.  
  6. template<typename P>
  7. struct Attributes
  8. {
  9. };
  10.  
  11. template<>
  12. struct Attributes<Foo>
  13. {
  14. };
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18. template<typename P>
  19. struct Frobnigator
  20. {
  21. Attributes<P> attributes;
  22. };
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25.  
  26. template<typename P>
  27. struct OuterHandler
  28. {
  29. typedef Frobnigator<P> Frob;
  30.  
  31. template<typename T>
  32. struct InnerHandler;
  33.  
  34. void doStuff();
  35. };
  36.  
  37. template<>
  38. struct OuterHandler<Foo>
  39. {
  40. typedef Frobnigator<Foo> Frob;
  41.  
  42. template<typename T>
  43. struct InnerHandler;
  44.  
  45. void doStuff();
  46. };
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49.  
  50. template<typename P>
  51. template<typename T>
  52. struct OuterHandler<P>::InnerHandler
  53. {
  54. typename T::Attributes attributes;
  55. InnerHandler(){}
  56. };
  57.  
  58.  
  59. template<typename T>
  60. struct OuterHandler<Foo>::InnerHandler
  61. {
  62. typename T::Attributes attributes;
  63. InnerHandler(){}
  64. };
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67.  
  68. template<typename P>
  69. void OuterHandler<P>::doStuff()
  70. {
  71. InnerHandler<Frob>();
  72. }
  73.  
  74. void OuterHandler<Foo>::doStuff()
  75. {
  76. InnerHandler<Frob>();
  77. }
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80.  
  81. int main()
  82. {
  83. return 0;
  84. }
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘struct OuterHandler<Foo>::InnerHandler<Frobnigator<Foo> >’:
prog.cpp:76:21:   required from here
prog.cpp:62:25: error: no type named ‘Attributes’ in ‘struct Frobnigator<Foo>’
  typename T::Attributes attributes;
                         ^
stdout
Standard output is empty