Skip to content

Commit e573870

Browse files
authored
Add "Remarks" and "Example" headings for error references in range [C3891, C3999]
1 parent c538d05 commit e573870

25 files changed

+88
-0
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c3891.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 6e1a9458-97f5-4580-bc0f-aa97a1bfd20d
1010

1111
> 'var' : a literal data member cannot be used as a l-value
1212
13+
## Remarks
14+
1315
A [literal](../../extensions/literal-cpp-component-extensions.md) variable is const, and its value cannot be changed after it is initialized in the declaration.
1416

17+
## Example
18+
1519
The following sample generates C3891:
1620

1721
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3892.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 83fff42c-ea48-442f-bc2e-b33a6b99d890
1010

1111
> 'var' : you cannot assign to a variable that is const
1212
13+
## Remarks
14+
1315
A const variable cannot be changed after it is declared and initialized.
1416

17+
## Example
18+
1519
The following sample generates C3892:
1620

1721
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3893.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ ms.assetid: 90d52eae-6ef2-4db1-b7ad-92f9e8b140fb
1010

1111
> 'var' : l-value use of initonly data member is only allowed in an instance constructor of class 'type_name'
1212
13+
## Remarks
14+
1315
Static [initonly](../../dotnet/initonly-cpp-cli.md) data members can only have their address taken in a static constructor.
1416

1517
Instance (non-static) initonly data members can only have their address taken in instance (non-static) constructors.
1618

19+
## Example
20+
1721
The following sample generates C3893:
1822

1923
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3894.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ ms.assetid: 6d5ac903-1dea-431d-8e3a-cebca4342983
1010

1111
> 'var' : l-value use of initonly static data member is only allowed in the class constructor of class 'class'
1212
13+
## Remarks
14+
1315
Static [initonly](../../dotnet/initonly-cpp-cli.md) data members can only be used as l-values at their point of declaration, or in a static constructor.
1416

1517
Instance (non-static) initonly data members can only be used as l-values at their point of declaration, or in instance (non-static) constructors.
1618

19+
## Example
20+
1721
The following sample generates C3894:
1822

1923
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3895.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 771b9fe5-d6d4-4297-bf57-e2f857722155
1010

1111
> 'var' : type data members cannot be 'volatile'
1212
13+
## Remarks
14+
1315
Certain kinds of data members, for example [literal](../../extensions/literal-cpp-component-extensions.md) or [initonly](../../dotnet/initonly-cpp-cli.md), cannot be [volatile](../../cpp/volatile-cpp.md).
1416

17+
## Example
18+
1519
The following sample generates C3895:
1620

1721
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3896.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: eb8be0f6-5b4e-4d71-8285-8a2a94f8ba29
1010

1111
> 'member' : improper initializer: this literal data member can only be initialized with 'nullptr'
1212
13+
## Remarks
14+
1315
A [literal](../../extensions/literal-cpp-component-extensions.md) data member was initialized incorrectly. See [nullptr](../../extensions/nullptr-cpp-component-extensions.md) for more information.
1416

17+
## Example
18+
1519
The following sample generates C3896:
1620

1721
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3898.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: d9a90df6-87e4-4fe7-ab01-c226ee86bf10
1010

1111
> 'var' : type data members can only be members of managed types
1212
13+
## Remarks
14+
1315
An [initonly](../../dotnet/initonly-cpp-cli.md) data member was declared in a native class. An **`initonly`** data member can only be declared in a CLR class.
1416

17+
## Example
18+
1519
The following sample generates C3898:
1620

1721
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3899.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 14e07e4a-f7a7-4309-baaa-649d69e12e23
1010

1111
> 'var' : l-value use of initonly data member is not allowed directly within a parallel region in class 'class'
1212
13+
## Remarks
14+
1315
An [initonly (C++/CLI)](../../dotnet/initonly-cpp-cli.md) data member cannot be initialized inside that part of a constructor that is in a [parallel](../../parallel/openmp/reference/openmp-directives.md#parallel) region. This is because the compiler does an internal relocation of that code, such that, it is effectively no longer part of the constructor.
1416

1517
To resolve, initialize the initonly data member in the constructor, but outside the parallel region.

docs/error-messages/compiler-errors-2/compiler-error-c3900.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ ms.assetid: a94cc561-8fa8-4344-9e01-e81ff462fae5
1010

1111
> 'member': not allowed in current scope
1212
13+
## Remarks
14+
1315
Property blocks can contain function declarations and inline function definitions only. No members other than functions are allowed in property blocks. No typedefs, operators, or friend functions are allowed. For more information, see [property](../../extensions/property-cpp-component-extensions.md).
1416

1517
Event definitions can only contain access methods and functions.
1618

19+
## Examples
20+
1721
The following sample generates C3900:
1822

1923
```cpp

docs/error-messages/compiler-errors-2/compiler-error-c3901.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 19af4141-39ad-4c16-a68f-3ae76f648186
1010

1111
> 'accessor_function': must have return type 'type'
1212
13+
## Remarks
14+
1315
At least one get method's return type must match the property type. For more information, see [property](../../extensions/property-cpp-component-extensions.md).
1416

17+
## Example
18+
1519
The following sample generates C3901:
1620

1721
```cpp

0 commit comments

Comments
 (0)