Share via


C6504

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

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.