0

I'm trying to create a templated class with a template parameter X that refers to a class or typedef defined within X. This snippet of code:

template <class X>
struct C {
    void Method(X::Child c);
};

Doesn't compile, because:

test.cc:3:20: error: ‘X::Child’ is not a type
     void Method(X::Child c);
                    ^~~~~

My understanding of SFINAE was that exactly this was allowed; I would expect that sort of error when the template was instantiated with a type X that doesn't have an inner type named Child, but here I get the error without instantiating the template at all.

Haldean Brown
  • 12,411
  • 5
  • 43
  • 58

0 Answers0