Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 772 Bytes

compiler-error-c3231.md

File metadata and controls

28 lines (23 loc) · 772 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C3231
Compiler Error C3231
11/04/2016
C3231
C3231
fe5dc352-e634-45fa-9534-3da176294c98

Compiler Error C3231

'arg' : template type argument cannot use a generic type parameter

Templates are instantiated at compile time, but generics are instantiated at run time. Therefore, it is not possible to generate generic code that can call the template because the template cannot be instantiated at run time when the generic type is finally known.

The following sample generates C3231:

// C3231.cpp
// compile with: /clr /LD
template <class T> class A;

generic <class T>
ref class C {
   void f() {
      A<T> a;   // C3231
   }
};