C6504

warning C6504: invalid annotation: property may only be used on values of pointer, pointer-to-member, or array type

This warning indicates the use of a property on an incompatible data type. For more information about data types supported by properties, see [NIB]Annotation Properties.

Example

The following code generates this warning because the _Null_ property cannot be used on the reference data type.

#include<sal.h>

class Point
{
public:
    //  members
};

void f(_Pre_ _Null_ Point& pt)
{
    // code ...
}

To correct this warning, use the following code:

#include<sal.h>

class Point
{
public:
    //  members
};

void f(_Pre_ _Null_  Point* pt)
{
    // code ...
}

The defective code shown earlier also generates warning C6516 because property conflicts resulted in an invalid annotation.