This documentation is archived and is not being maintained.

Compiler Error C3342

Error Message

'attribute': ambiguous attribute

The compiler found more than one definition of an attribute.

An attribute was defined more than once.

For more information, see User-Defined Attributes.


The following sample generates C3342.

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

public ref class XAttribute : public  Attribute {};

public ref class X : public Attribute {};

[X]   // C3342 could refer to X or XAttribute
// try the following line instead
// [XAttribute]
public ref class Class4 {};