Skip to content

Commit 6e1d026

Browse files
authored
Add "Remarks" and "Example" headings for error references in range [C2521, C2550]
1 parent fda1c3c commit 6e1d026

22 files changed

+70
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 6042821b-e345-4a54-a7e9-a2c9019ea016
1010

1111
> function does not take any arguments
1212
13+
## Remarks
14+
1315
You attempted to use arguments with a destructor or finalizer.
1416

1517
For more information, see [Destructors and finalizers](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers).

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 7951b700-8f37-45a0-beb4-a79ae0ced72e
1010

1111
> 'class::~identifier' : destructor/finalizer tag mismatch
1212
13+
## Remarks
14+
1315
The name of the destructor must be the class name preceded by a tilde (`~`). The constructor and destructor are the only members that have the same name as the class.
1416

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

1721
```cpp

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: e71d17f5-2fc2-416b-8dbd-e9bed85eb33a
1010

1111
> 'destructor' : a destructor/finalizer must have a 'void' parameter list
1212
13+
## Remarks
14+
1315
The destructor or finalizer had a parameter list that is not [void](../../cpp/void-cpp.md). Other parameter types are not allowed.
1416

1517
## Examples

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ helpviewer_keywords: ["C2526"]
99

1010
> 'identifier1' : C linkage function cannot return C++ class 'identifier2'
1111
12+
## Remarks
13+
1214
A function defined with C linkage cannot return a user-defined type.
1315

16+
## Example
17+
1418
The following sample generates C2526:
1519

1620
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 2ea9d583-67a8-4b16-b35f-a50eeffc03c4
1010

1111
> 'name' : pointer to reference is illegal
1212
13+
## Remarks
14+
1315
You cannot declare a pointer to a reference. Dereference the variable before declaring a pointer to it.
1416

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

1721
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 73a99e55-b91e-488d-9b72-cc80faaeb436
1010

1111
> 'name' : reference to reference is illegal
1212
13+
## Remarks
14+
1315
This error may be fixed by using pointer syntax and declaring a reference to a pointer.
1416

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

1721
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: b790a312-48df-4a6a-9e27-be2c5f32f16c
1010

1111
> 'identifier' : references must be initialized
1212
13+
## Remarks
14+
1315
You must initialize a reference when it was declared, unless it is declared already:
1416

1517
- With the keyword [extern](../../cpp/extern-cpp.md).
@@ -20,6 +22,8 @@ You must initialize a reference when it was declared, unless it is declared alre
2022

2123
- As the return type of a function.
2224

25+
## Example
26+
2327
The following sample generates C2530:
2428

2529
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: c49afe15-55f8-4dc8-ac01-bf653622a7db
1010

1111
> 'identifier' : reference to a bit field illegal
1212
13+
## Remarks
14+
1315
References to bit fields are not allowed.
1416

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

1721
```cpp

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ ms.assetid: a94fdf13-5063-4206-b5a5-374930287bee
1010

1111
> 'identifier' : illegal modifier for reference
1212
13+
## Remarks
14+
1315
The reference was changed. References cannot be modified to refer to another object. Use a pointer instead.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ ms.assetid: 5b335652-076c-4824-87c8-a741f64a3ce0
1010

1111
> 'identifier' : constructors not allowed a return type
1212
13+
## Remarks
14+
1315
A constructor cannot have a return type (not even a **`void`** return type).
1416

1517
A common source of this error is a missing semicolon between the end of a class definition and the first constructor implementation. The compiler sees the class as a definition of the return type for the constructor function, and generates C2533.
1618

19+
## Example
20+
1721
The following sample generates C2533, and shows how to fix it:
1822

1923
```cpp

0 commit comments

Comments
 (0)