From 26f2473e152f9698cf00a5e9554f493b73685fbe Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Sun, 29 Jun 2025 18:49:10 +0800 Subject: [PATCH 1/4] Update C2556 error message and add blockquotes --- docs/error-messages/compiler-errors-2/compiler-error-c2556.md | 2 +- .../compiler-errors-2/compiler-errors-c2500-through-c2599.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md index c53302f927..6c1bf3e2e0 100644 --- a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md +++ b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md @@ -8,7 +8,7 @@ ms.assetid: fc4399ad-45b3-49fd-be1f-0b13956a595a --- # Compiler Error C2556 -'identifier' : overloaded functions only differ by return type +> '*function1*': overloaded function differs only by return type from '*function2*' The overloaded functions have different return types but the same parameter list. Each overloaded function must have a distinct formal parameter list. diff --git a/docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md b/docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md index 62ed444ca7..d6a27711af 100644 --- a/docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md +++ b/docs/error-messages/compiler-errors-2/compiler-errors-c2500-through-c2599.md @@ -71,7 +71,7 @@ The articles in this section of the documentation explain a subset of the error |[Compiler error C2553](compiler-error-C2553.md)|'*type* *derived_class*::*function*': overriding virtual function return type differs from '*type* *base_class*::*function*'| |Compiler error C2554|'*variable*': 'constinit' only allowed on a variable declaration with static or thread storage duration| |[Compiler error C2555](compiler-error-C2555.md)|'*derived_class*::*function*': overriding virtual function return type differs and is not covariant from '*base_class*::*function*'| -|[Compiler error C2556](compiler-error-C2556.md)|'*type1* *class*::*function*': overloaded function differs only by return type from '*type2* *class*::*function*'| +|[Compiler error C2556](compiler-error-C2556.md)|'*function1*': overloaded function differs only by return type from '*function2*'| |[Compiler error C2557](compiler-error-C2557.md)|'*identifier*': private and protected members cannot be initialized without a constructor| |[Compiler error C2558](compiler-error-C2558.md)|class '*class*': no copy constructor available or copy constructor is declared 'explicit'| |Compiler error C2559|'*identifier*': cannot overload a member function without ref-qualifier with a member function with ref-qualifier| From 473f8b14f1522a8c45984a2407bbb9f8fd2dbb93 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Sun, 29 Jun 2025 18:52:24 +0800 Subject: [PATCH 2/4] Add "Remarks" and "Example" headings in C2556 error reference --- .../compiler-errors-2/compiler-error-c2556.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md index 6c1bf3e2e0..1d38097787 100644 --- a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md +++ b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md @@ -10,9 +10,13 @@ ms.assetid: fc4399ad-45b3-49fd-be1f-0b13956a595a > '*function1*': overloaded function differs only by return type from '*function2*' +## Remarks + The overloaded functions have different return types but the same parameter list. Each overloaded function must have a distinct formal parameter list. -The following sample generates C2556: +## Example + +The following example generates C2556: ```cpp // C2556.cpp From 6f2b481d34b9477a85156fee9e5eec745f5f1e44 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Sun, 29 Jun 2025 18:57:12 +0800 Subject: [PATCH 3/4] Simplify and tweak example in C2556 error reference --- .../compiler-errors-2/compiler-error-c2556.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md index 1d38097787..08baf37f6f 100644 --- a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md +++ b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md @@ -21,9 +21,7 @@ The following example generates C2556: ```cpp // C2556.cpp // compile with: /c -class C { - int func(); - double func(); // C2556 - int func(int i); // ok parameter lists differ -}; +int func(); +double func(); // C2556 +int func(int i); // OK parameter lists differ ``` From c79bf08fd4638bee171abcaf95f7683929756c55 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+Rageking8@users.noreply.github.com> Date: Sun, 29 Jun 2025 18:58:45 +0800 Subject: [PATCH 4/4] Update metadata in C2556 error reference --- .../error-messages/compiler-errors-2/compiler-error-c2556.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md index 08baf37f6f..25a188c34c 100644 --- a/docs/error-messages/compiler-errors-2/compiler-error-c2556.md +++ b/docs/error-messages/compiler-errors-2/compiler-error-c2556.md @@ -1,10 +1,9 @@ --- -description: "Learn more about: Compiler Error C2556" title: "Compiler Error C2556" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2556" +ms.date: 06/29/2025 f1_keywords: ["C2556"] helpviewer_keywords: ["C2556"] -ms.assetid: fc4399ad-45b3-49fd-be1f-0b13956a595a --- # Compiler Error C2556