C6504

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see C6504 on docs.microsoft.com. 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 Annotation Properties.

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.

Show: