Skip to content

Structure error references in range [C2581, C2610] #5609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2581.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C2581"
title: "Compiler Error C2581"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2581"
ms.date: 11/04/2016
f1_keywords: ["C2581"]
helpviewer_keywords: ["C2581"]
ms.assetid: 24a4e4c1-24d3-4e42-b760-7dcaf9740b16
---
# Compiler Error C2581

'type' : static 'operator =' function is illegal
> 'type' : static 'operator =' function is illegal

## Remarks

The assignment (`=`) operator is incorrectly declared as **`static`**. Assignment operators cannot be **`static`**. For more information, see [User-Defined Operators (C++/CLI)](../../dotnet/user-defined-operators-cpp-cli.md).

## Example

The following sample generates C2581.
The following example generates C2581.

```cpp
// C2581.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2582.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2582"
title: "Compiler Error C2582"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2582"
ms.date: 11/04/2016
f1_keywords: ["C2582"]
helpviewer_keywords: ["C2582"]
ms.assetid: ee1b9378-8bcd-4792-b87e-6d7a466d29ed
---
# Compiler Error C2582

'function' function is unavailable in 'type'
> 'function' function is unavailable in 'type'

## Remarks

An attempt was made to assign to an object that does not have an assignment operator.

The following sample generates C2582:
## Example

The following example generates C2582:

```cpp
// C2582.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2584.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Error C2584"
title: "Compiler Error C2584"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2584"
ms.date: 11/04/2016
f1_keywords: ["C2584"]
helpviewer_keywords: ["C2584"]
ms.assetid: 836e2c0a-86c0-4742-b432-beb0191ad20e
---
# Compiler Error C2584

'Class' : direct base 'Base2' is inaccessible; already a base of 'Base1'
> 'Class' : direct base 'Base2' is inaccessible; already a base of 'Base1'

## Remarks

`Class` already derives directly from `Base1`. `Base2` also derives from `Base1`. `Class` cannot derive from `Base2` because that would mean inheriting (indirectly) from `Base1` again, which is not legal because `Base1` is already a direct base class.

## Example

The following sample generates C2584.
The following example generates C2584.

```cpp
// C2584.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2585.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2585"
title: "Compiler Error C2585"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2585"
ms.date: 11/04/2016
f1_keywords: ["C2585"]
helpviewer_keywords: ["C2585"]
ms.assetid: 05bb1a9c-28fb-4a88-a1b5-aea85ebdee1c
---
# Compiler Error C2585

explicit conversion to 'type' is ambiguous
> explicit conversion to 'type' is ambiguous

## Remarks

The type conversion can produce more than one result.

Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2586.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2586"
title: "Compiler Error C2586"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2586"
ms.date: 11/04/2016
f1_keywords: ["C2586"]
helpviewer_keywords: ["C2586"]
ms.assetid: dae703c7-5c38-4db6-8411-4d1b22713eb5
---
# Compiler Error C2586

incorrect user-defined conversion syntax : illegal indirections
> incorrect user-defined conversion syntax : illegal indirections

## Remarks

Indirection of a conversion operator is not allowed.

The following sample generates C2586:
## Example

The following example generates C2586:

```cpp
// c2586.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2587.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2587"
title: "Compiler Error C2587"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2587"
ms.date: 11/04/2016
f1_keywords: ["C2587"]
helpviewer_keywords: ["C2587"]
ms.assetid: 7637a2c7-35d4-4b5a-a8f2-515a7bda98fd
---
# Compiler Error C2587

'identifier' : illegal use of local variable as default parameter
> 'identifier' : illegal use of local variable as default parameter

## Remarks

Local variables are not allowed as default parameters.

The following sample generates C2587:
## Example

The following example generates C2587:

```cpp
// C2587.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2588.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Error C2588"
title: "Compiler Error C2588"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2588"
ms.date: 11/04/2016
f1_keywords: ["C2588"]
helpviewer_keywords: ["C2588"]
ms.assetid: 19a0cabd-ca13-44a5-9be3-ee676abf9bc4
---
# Compiler Error C2588

'::~identifier' : illegal global destructor
> '::~identifier' : illegal global destructor

## Remarks

The destructor is defined for something other than a class, structure, or union. This is not allowed.

This error can be caused by a missing class, structure, or union name on the left side of the scope resolution (`::`) operator.

The following sample generates C2588:
## Example

The following example generates C2588:

```cpp
// C2588.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2589.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Error C2589"
title: "Compiler Error C2589"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2589"
ms.date: 11/04/2016
f1_keywords: ["C2589"]
helpviewer_keywords: ["C2589"]
ms.assetid: 1d7942c7-8a81-4bb4-b272-76a0019e8513
---
# Compiler Error C2589

'identifier' : illegal token on right side of '::'
> 'identifier' : illegal token on right side of '::'

## Remarks

If a class, structure, or union name appears to the left of the scope-resolution operator (double colons), the token on the right must be a class, structure, or union member. Otherwise, any global identifier can appear on the right.

The scope-resolution operator cannot be overloaded.

The following sample generates C2589:
## Example

The following example generates C2589:

```cpp
// C2589.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2592.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2592"
title: "Compiler Error C2592"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2592"
ms.date: 11/04/2016
f1_keywords: ["C2592"]
helpviewer_keywords: ["C2592"]
ms.assetid: 833a4d7b-66ef-4d4c-ae83-a533c2b0eb07
---
# Compiler Error C2592

'class': 'base_class_2' is inherited from 'base_class_1' and cannot be re-specified
> 'class': 'base_class_2' is inherited from 'base_class_1' and cannot be re-specified

## Remarks

You can only specify base classes that do not inherit from other base classes. In this case, only `base_class_1` is needed in the specification of **`class`** because `base_class_1` already inherits `base_class_2`.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2593.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Error C2593"
title: "Compiler Error C2593"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2593"
ms.date: 11/04/2016
f1_keywords: ["C2593"]
helpviewer_keywords: ["C2593"]
ms.assetid: 4a0fe9bb-2163-447d-91f6-1890ed8250f6
---
# Compiler Error C2593

'operator identifier' is ambiguous
> 'operator identifier' is ambiguous

## Remarks

More than one possible operator is defined for an overloaded operator.

This error may be fixed if you use an explicit cast on one or more actual parameters.

The following sample generates C2593:
## Examples

The following example generates C2593:

```cpp
// C2593.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2594.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2594"
title: "Compiler Error C2594"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2594"
ms.date: 11/04/2016
f1_keywords: ["C2594"]
helpviewer_keywords: ["C2594"]
ms.assetid: 68cd708f-266e-44b0-a211-3e3ab63b11bf
---
# Compiler Error C2594

'operator' : ambiguous conversions from 'type1' to 'type2'
> 'operator' : ambiguous conversions from 'type1' to 'type2'

## Remarks

No conversion from *type1* to *type2* was more direct than any other. We suggest two possible solutions to converting from *type1* to *type2*. The first option is to define a direct conversion from *type1* to *type2*, and the second option is to specify a sequence of conversions from *type1* to *type2*.

The following sample generates C2594. The suggested resolution to the error is a sequence of conversions:
## Example

The following example generates C2594. The suggested resolution to the error is a sequence of conversions:

```cpp
// C2594.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2597.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2597"
title: "Compiler Error C2597"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2597"
ms.date: 11/04/2016
f1_keywords: ["C2597"]
helpviewer_keywords: ["C2597"]
ms.assetid: 2e48127d-e3ff-4a40-8156-2863e45b1a38
---
# Compiler Error C2597

illegal reference to non-static member 'identifier'
> illegal reference to non-static member 'identifier'

## Remarks

Possible causes:

Expand All @@ -18,7 +19,9 @@ Possible causes:

1. A member access operator refers to a nonmember function.

1. The following sample generates C2597 and shows how to fix it:
## Example

1. The following example generates C2597 and shows how to fix it:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A separate PR will be issued to remove the "1.", together with #5583 (comment).


```cpp
// C2597.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2598.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2598"
title: "Compiler Error C2598"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2598"
ms.date: 11/04/2016
f1_keywords: ["C2598"]
helpviewer_keywords: ["C2598"]
ms.assetid: 40777c62-39ba-441e-b081-f49f94b43547
---
# Compiler Error C2598

linkage specification must be at global scope
> linkage specification must be at global scope

## Remarks

The linkage specifier is declared at local scope.

The following sample generates C2598:
## Example

The following example generates C2598:

```cpp
// C2598.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2599.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Error C2599"
title: "Compiler Error C2599"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2599"
ms.date: 11/04/2016
f1_keywords: ["C2599"]
helpviewer_keywords: ["C2599"]
ms.assetid: 88515f36-7589-47e2-862e-0de8b18d6668
---
# Compiler Error C2599

'enum' : forward declaration of enum type is not allowed
> 'enum' : forward declaration of enum type is not allowed

## Remarks

The compiler no longer supports forward declaration of a managed enumeration.

Forward declaration of an enum type is not allowed under [/Za](../../build/reference/za-ze-disable-language-extensions.md).

The following sample generates C2599:
## Example

The following example generates C2599:

```cpp
// C2599.cpp
Expand Down
Loading