Share via


C6503

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 C6503: Invalid annotation: references and arrays may not be marked Null=Yes or Null=Maybe

Note

This warning occurs only in code that is using a deprecated version of the source-code annotation language (SAL). We recommend that you port your code to use the latest version of SAL. For more information, see Using SAL Annotations to Reduce C/C++ Code Defects.

This warning indicates that Null property is incorrectly used on a reference or array type. A reference or array type holds the address of an object and must point to a valid object. Because reference and array types cannot be null, you must correct the error by either removing the Null property or by setting the Null property value to No.

Example

The following code generates this warning:

// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
class Point  
{  
public:  
    //  members  
};  
  
void f([Pre(Null=Yes)] Point& pt);  

To correct this warning, set the Null property to No as shown in the following code:

// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
  
class Point  
{  
public:  
    //  members  
};   
void f([Pre(Null=No)] Point& pt);  

See Also

Annotation Properties