Edit

Share via


Compiler Error C3094

'attribute': anonymous usage not allowed

An attribute was not scoped correctly. For more information, see User-Defined Attributes.

Example

The following sample generates C3094.

// C3094.cpp
// compile with: /clr /c
using namespace System;
[AttributeUsage(AttributeTargets::Class)]
public ref class AAttribute : Attribute {};

[A];   // C3094

// OK
[A]
ref class x{};