Partager via


Erreur du compilateur C2364

'type' : type d’attribut personnalisé non conforme

Les arguments nommés pour les attributs personnalisés sont limités aux constantes de temps de compilation. Par exemple, les types intégraux (int, char, etc.), System ::Type^, et System ::Object^.

Exemple

L’exemple suivant génère l’erreur C2364.

// c2364.cpp
// compile with: /clr /c
using namespace System;

[attribute(AttributeTargets::All)]
public ref struct ABC {
public:
   // Delete the following line to resolve.
   ABC( Enum^ ) {}   // C2364
   ABC( int ) {}   // OK
};