Compiler Error C2364
'type': illegal type for custom attribute
Named arguments for custom attributes are limited to compile time constants. For example, integral types (int, char, etc.), System::Type^, and System::Object^.
Example
The following sample generates 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
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for