C6504
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at 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 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: