The “property” Declaration Specifier

Syntax

Within a __declspec, this specifier is

property ( property [[, property ]...] )

It is a syntax error (C2059) if the first token after property is not an opening parenthesis.

The compiler then assumes that the specifier is used to declare a member of some type and that this declaration lies within the definition of the containing type. It is an error (C3760) if this type is a managed type. There will typically be an internal compiler error (C1001) if the specifier is applied outside the definition of any type, managed or not.

After the opening parenthesis, there must be one or more properties, each but the first introduced by a comma. The expected form for each property is

name = value

It is a syntax error (C2059) if the first token where a property is expected is not an identifier for the name. It is another syntax error (C2061) if the name is not one of get or put. If name is get, then it is an error (C2776) if the object being specified already has a get property, whether from this specifier or an earlier one. Similarly, if name is put, it is an error (C2777) if the object being specified already has a put property. It is one sort or another of syntax error (C2143 or C2146) if the first token after name is not an equals sign, and yet another (C2061) if the token after that is not an identifier for the value.

After a property, a closing parenthesis ends the specifier, a comma signals to expect another property, and anything else is a syntax error (C2059).