Compiler Error C3094
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 C3094.
attribute': anonymous usage not allowed
An attribute was not scoped correctly. For more information, see User-Defined Attributes.
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{};
Show: