Skip to content

Commit 8faaf3c

Browse files
authored
Add "Remarks" and "Example" headings for error references in range [C2551, C2580]
1 parent 690631b commit 8faaf3c

20 files changed

+60
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ ms.assetid: 6f48b91d-635b-4eef-b13c-1bf2056c1053
1010

1111
> 'void *' type needs explicit cast
1212
13+
## Remarks
14+
1315
A **`void`** pointer is assigned to a nonvoid pointer by implicit conversion. You must use an explicit cast.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 0e0ab759-788a-4faf-9337-80d4b9e2e8c9
1010

1111
> 'identifier' : non-aggregates cannot be initialized with initializer list
1212
13+
## Remarks
14+
1315
The aggregate identifier was incorrectly initialized.
1416

1517
[Aggregates](../../c-language/initializing-aggregate-types.md) are defined as:
@@ -42,6 +44,8 @@ The following represent the reasons C2552 may fire when an aggregate initializat
4244

4345
- The type has a non-fixed dimension array (zero-array) whose elements have destructors.
4446

47+
## Example
48+
4549
The following sample generates C2552:
4650

4751
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 64bc1e9a-627f-4ce9-b7bc-dc911bdb9180
1010

1111
> 'base_function': overriding virtual function return type differs from 'override_function'
1212
13+
## Remarks
14+
1315
A function in a derived class attempted to override a virtual function in a base class, but the derived class function did not have the same return type as the base class function. An override function signature must match the signature of the function being overridden.
1416

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

1721
```cpp

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ ms.assetid: 5e49ebb8-7c90-457a-aa12-7ca7ab6574b2
1010

1111
> '*class1*::*function1*': overriding virtual function return type differs and is not covariant from '*class2*::*function2*'
1212
13-
A virtual function and a derived overriding function have identical parameter lists but different return types.
14-
1513
## Remarks
1614

15+
A virtual function and a derived overriding function have identical parameter lists but different return types.
16+
1717
In C++, an overriding function in a derived class can't differ only by return type from a virtual function in a base class.
1818

1919
There's an exception to this rule for certain return types. When a derived class overrides a public base class, it may return a pointer or reference to the derived class instead of a base-class pointer or reference. These return types are called *covariant*, because they vary together with the type. This rule exception doesn't allow covariant reference-to-pointer or pointer-to-pointer types.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ ms.assetid: 48a33d82-aa16-4658-b346-2311fcb39864
1010

1111
> 'identifier' : private and protected members cannot be initialized without a constructor
1212
13+
## Remarks
14+
1315
Only members and friends can assign a value to a private or protected member. Nonpublic members should be initialized in the class constructor.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 822b701e-dcae-423a-b21f-47f36aff9c90
1010

1111
> 'identifier' : no copy constructor available or copy constructor is declared 'explicit'
1212
13+
## Remarks
14+
1315
A copy constructor initializes an object from another object of the same type. (It makes a copy of the object.) The compiler generates a default copy constructor if you do not define any constructors.
1416

1517
### To fix this error

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 0abe955b-53a6-4a3c-8362-b1a8eb40e8d1
1010

1111
> 'identifier' : function must return a value
1212
13+
## Remarks
14+
1315
The function was declared as returning a value, but the function definition does not contain a **`return`** statement.
1416

1517
This error can be caused by an incorrect function prototype:
@@ -20,6 +22,8 @@ This error can be caused by an incorrect function prototype:
2022

2123
1. C++ functions containing inline assembly routines that store the return value in the `AX` register may need a return statement. Copy the value in `AX` to a temporary variable and return that variable from the function.
2224

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

2529
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ ms.assetid: 2c41e511-9952-4b98-9976-6b1523613e1b
1010

1111
> 'identifier' : 'void' function returning a value
1212
13+
## Remarks
14+
1315
The function is declared as **`void`** but returns a value.
1416

1517
This error can be caused by an incorrect function prototype.
1618

1719
This error may be fixed if you specify the return type in the function declaration.
1820

21+
## Example
22+
1923
The following sample generates C2562:
2024

2125
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 54abba68-6458-4ca5-894d-3babdb7b3552
1010

1111
> mismatch in formal parameter list
1212
13+
## Remarks
14+
1315
The formal parameter list of a function (or a pointer to a function) does not match those of another function (or pointer to a member function). As a result, the assignment of functions or pointers cannot be made.
1416

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

1721
```cpp

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ ms.assetid: 8fe10fb2-d974-432a-a56b-3a61b9a8dfc2
1010

1111
> overloaded function in conditional expression
1212
13+
## Remarks
14+
1315
An overloaded function in a conditional expression cannot be evaluated.

0 commit comments

Comments
 (0)