Compiler Error C3390
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3390.
type_arg' : invalid type argument for generic parameter 'param' of generic 'generic_type', must be a reference type
A generic type was instantiated incorrectly. Check the type definition. For more information, see Generics.
The following sample, using C#, creates a component that contains a generic type, with certain constraints that are not supported when authoring generic types in Visual C++ 2005. For more information, see .Constraints on Type Parameters.
// C3390.cs
// compile with: /target:library
// a C# program
public class GR<C, V, N>
where C : class
where V : struct
where N : new() {}
The following sample generates C3390.
// C3390_b.cpp
// compile with: /clr
#using <C3390.dll>
ref class R { R(int) {} };
value class V {};
ref struct N { N() {} };
int main () {
GR<V, V, N^>^ gr2; // C3390 first type must be a ref type
GR<R^, V, N^>^ gr2b; // OK
}
Show: