C6508

warning C6508: invalid annotation: write access is not allowed on const values

This warning indicates that the Access property specified on a const parameter implies that it can be written to. For constant values, Access=Read is the only valid setting.

Example

The following code generates this warning:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void fD ([SA_Pre(Deref=1,Access=SA_Write)]const char *pc); 

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(Deref=1,Access=Write)]const char *pc);

To correct this warning, use the following code:

// C
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(Deref=1,Access=SA_Read)]const char *pc); 

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(Deref=1,Access=Read)]const char *pc);

See Also

Reference

Deref

Access