Dela via


C6501

warning C6501: annotation conflict: <name> property conflicts with previously specified property

This warning indicates the presence of conflicting properties in the annotation. This typically occurs when multiple properties that serve similar purpose are used to annotate a parameter or return value. To correct the warning, you must choose the property that best addresses your need.

Example

The following code generates this warning because both ValidElementsConst and ValidBytesConst provide a mechanism to allow valid data to be read:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void fd([SA_Pre(ValidElementsConst =4, ValidBytesConst =4)] char pch[]);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [Pre(ValidElementsConst=4, ValidBytesConst=4 )] char pch[] );

To correct this warning, use the most appropriate property, as shown in the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f( [SA_Pre(ValidElementsConst=4)] char pch[] );

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f( [Pre(ValidElementsConst=4)] char pch[] );

See Also

Reference

ValidElementsConst

ValidBytesConst