Delen via


Fatale fout C1202

Recursieve type- of functieafhankelijkheidscontext is te complex

Opmerkingen

Een sjabloondefinitie was recursief of heeft de complexiteitslimieten overschreden.

Voorbeeld

In het volgende voorbeeld wordt C1202 gegenereerd.

// C1202.cpp
// processor: x86 IPF
template<int n>
class Factorial : public Factorial<n-1>  {   // C1202
public:
   operator int () {
      return Factorial <n-1>::operator int () * n;
   }
};
Factorial<7> facSeven;

Mogelijke oplossing.

// C1202b.cpp
// compile with: /c
template<int n>
class Factorial : public Factorial<n-1> {
public:
   operator int () {
      return Factorial <n-1>::operator int () * n;
   }
};

template <>
class Factorial<0> {
public:
   operator int () {
      return 1;
   }
};

Factorial<7> facSeven;