C6515

warning C6515 - invalid annotation: <name> property may only be used on values of pointer type

This warning indicates that a property for use on pointers was applied to a non-pointer type. For a list of annotation properties, see Annotation Properties.

Example

The following code generates this warning:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ValidBytes="c")] char pc, size_t c);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(ValidBytes="c")] char pc, size_t c);

To correct this warning, the following sample code uses pointer-to-character parameter to the function:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(ValidBytes="c")] char *pc, size_t c);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(ValidBytes="c")] char *pc, size_t c); 

ValidBytes property cannot be applied to a function pointer.

See Also

Reference

C6516