Skip to content

Commit 7086db1

Browse files
Merge pull request #5603 from Rageking8/structure-error-references-in-range-c2551-c2580
Structure error references in range [C2551, C2580]
2 parents 39a9f23 + 154e3b7 commit 7086db1

20 files changed

+130
-92
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Error C2551"
32
title: "Compiler Error C2551"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2551"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2551"]
66
helpviewer_keywords: ["C2551"]
7-
ms.assetid: 6f48b91d-635b-4eef-b13c-1bf2056c1053
87
---
98
# Compiler Error C2551
109

11-
'void *' type needs explicit cast
10+
> 'void *' type needs explicit cast
11+
12+
## Remarks
1213

1314
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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C2552"
32
title: "Compiler Error C2552"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2552"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2552"]
66
helpviewer_keywords: ["C2552"]
7-
ms.assetid: 0e0ab759-788a-4faf-9337-80d4b9e2e8c9
87
---
98
# Compiler Error C2552
109

11-
'identifier' : non-aggregates cannot be initialized with initializer list
10+
> 'identifier' : non-aggregates cannot be initialized with initializer list
11+
12+
## Remarks
1213

1314
The aggregate identifier was incorrectly initialized.
1415

@@ -42,7 +43,9 @@ The following represent the reasons C2552 may fire when an aggregate initializat
4243

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

45-
The following sample generates C2552:
46+
## Example
47+
48+
The following example generates C2552:
4649

4750
```cpp
4851
// C2552.cpp

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2553"
32
title: "Compiler Error C2553"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2553"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2553"]
66
helpviewer_keywords: ["C2553"]
7-
ms.assetid: 64bc1e9a-627f-4ce9-b7bc-dc911bdb9180
87
---
98
# Compiler Error C2553
109

11-
'base_function': overriding virtual function return type differs from 'override_function'
10+
> 'base_function': overriding virtual function return type differs from 'override_function'
11+
12+
## Remarks
1213

1314
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.
1415

15-
The following sample generates C2553:
16+
## Example
17+
18+
The following example generates C2553:
1619

1720
```cpp
1821
// C2553.cpp

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
22
title: "Compiler Error C2555"
33
description: "Reference for Visual Studio C++ compiler error C2555."
4-
ms.date: "03/30/2020"
4+
ms.date: 03/30/2020
55
f1_keywords: ["C2555"]
66
helpviewer_keywords: ["C2555"]
7-
ms.assetid: 5e49ebb8-7c90-457a-aa12-7ca7ab6574b2
87
---
98
# Compiler Error C2555
109

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

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

1918
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.
@@ -34,7 +33,7 @@ is
3433
Guid CheckSources(Guid sourceID, Guid carouselIDs[]) [];
3534
```
3635
37-
The following sample generates C2555:
36+
The following example generates C2555:
3837
3938
```cpp
4039
// C2555.cpp
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Error C2557"
32
title: "Compiler Error C2557"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2557"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2557"]
66
helpviewer_keywords: ["C2557"]
7-
ms.assetid: 48a33d82-aa16-4658-b346-2311fcb39864
87
---
98
# Compiler Error C2557
109

11-
'identifier' : private and protected members cannot be initialized without a constructor
10+
> 'identifier' : private and protected members cannot be initialized without a constructor
11+
12+
## Remarks
1213

1314
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C2558"
32
title: "Compiler Error C2558"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2558"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2558"]
66
helpviewer_keywords: ["C2558"]
7-
ms.assetid: 822b701e-dcae-423a-b21f-47f36aff9c90
87
---
98
# Compiler Error C2558
109

11-
'identifier' : no copy constructor available or copy constructor is declared 'explicit'
10+
> 'identifier' : no copy constructor available or copy constructor is declared 'explicit'
11+
12+
## Remarks
1213

1314
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.
1415

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Error C2561"
32
title: "Compiler Error C2561"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2561"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2561"]
66
helpviewer_keywords: ["C2561"]
7-
ms.assetid: 0abe955b-53a6-4a3c-8362-b1a8eb40e8d1
87
---
98
# Compiler Error C2561
109

11-
'identifier' : function must return a value
10+
> 'identifier' : function must return a value
11+
12+
## Remarks
1213

1314
The function was declared as returning a value, but the function definition does not contain a **`return`** statement.
1415

@@ -20,7 +21,9 @@ This error can be caused by an incorrect function prototype:
2021

2122
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.
2223

23-
The following sample generates C2561:
24+
## Example
25+
26+
The following example generates C2561:
2427

2528
```cpp
2629
// C2561.cpp

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
---
2-
description: "Learn more about: Compiler Error C2562"
32
title: "Compiler Error C2562"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2562"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2562"]
66
helpviewer_keywords: ["C2562"]
7-
ms.assetid: 2c41e511-9952-4b98-9976-6b1523613e1b
87
---
98
# Compiler Error C2562
109

11-
'identifier' : 'void' function returning a value
10+
> 'identifier' : 'void' function returning a value
11+
12+
## Remarks
1213

1314
The function is declared as **`void`** but returns a value.
1415

1516
This error can be caused by an incorrect function prototype.
1617

1718
This error may be fixed if you specify the return type in the function declaration.
1819

19-
The following sample generates C2562:
20+
## Example
21+
22+
The following example generates C2562:
2023

2124
```cpp
2225
// C2562.cpp

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Error C2563"
32
title: "Compiler Error C2563"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2563"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2563"]
66
helpviewer_keywords: ["C2563"]
7-
ms.assetid: 54abba68-6458-4ca5-894d-3babdb7b3552
87
---
98
# Compiler Error C2563
109

11-
mismatch in formal parameter list
10+
> mismatch in formal parameter list
11+
12+
## Remarks
1213

1314
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.
1415

15-
The following sample generates C2563:
16+
## Example
17+
18+
The following example generates C2563:
1619

1720
```cpp
1821
// C2563.cpp
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Error C2566"
32
title: "Compiler Error C2566"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2566"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2566"]
66
helpviewer_keywords: ["C2566"]
7-
ms.assetid: 8fe10fb2-d974-432a-a56b-3a61b9a8dfc2
87
---
98
# Compiler Error C2566
109

11-
overloaded function in conditional expression
10+
> overloaded function in conditional expression
11+
12+
## Remarks
1213

1314
An overloaded function in a conditional expression cannot be evaluated.

0 commit comments

Comments
 (0)