Skip to content

Structure error references in range [C2701, C2730] #5621

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions docs/error-messages/compiler-errors-2/compiler-error-c2701.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2701"
title: "Compiler Error C2701"
description: "Learn more about: Compiler Error C2701"
ms.date: 09/27/2022
f1_keywords: ["C2701"]
helpviewer_keywords: ["C2701"]
ms.assetid: 31cf2ab7-ced9-4f75-aa51-e169e20407fb
---
# Compiler Error C2701

> 'function': a function template cannot be a `friend` of a local class

## Remarks

A local class can't have a function template as a `friend` function.

The following sample generates C2701:
## Example

The following example generates C2701:

```cpp
// C2701.cpp
Expand Down
7 changes: 5 additions & 2 deletions docs/error-messages/compiler-errors-2/compiler-error-c2702.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ description: "Describes Microsoft C/C++ compiler error C2702."
ms.date: 08/25/2020
f1_keywords: ["C2702"]
helpviewer_keywords: ["C2702"]
ms.assetid: 6def15d4-9a8d-43e7-ae35-42d7cb57c27e
---
# Compiler Error C2702

> `__except` may not appear in termination block

## Remarks

An exception handler (**`__try`**/**`__except`**) cannot be nested inside a **`__finally`** block.

The following sample generates C2702:
## Example

The following example generates C2702:

```cpp
// C2702.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description: "Describes Microsoft C/C++ compiler error C2703."
ms.date: 08/24/2020
f1_keywords: ["C2703"]
helpviewer_keywords: ["C2703"]
ms.assetid: 384295c3-643d-47ae-a9a6-865b3036aa84
---
# Compiler Error C2703

Expand All @@ -16,7 +15,7 @@ A **`__leave`** statement must be inside a **`__try`** block.

## Example

The following sample generates C2703:
The following example generates C2703:

```cpp
// C2703.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2704.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2704"
title: "Compiler Error C2704"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2704"
ms.date: 11/04/2016
f1_keywords: ["C2704"]
helpviewer_keywords: ["C2704"]
ms.assetid: 185797e2-55b5-4c11-8493-e70eb1d15a94
---
# Compiler Error C2704

'identifier' : __va_start intrinsic only allowed in varargs
> 'identifier' : __va_start intrinsic only allowed in varargs

## Remarks

The `__va_start` intrinsic is used in a declaration for a function with a fixed number of arguments.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description: "Describes Microsoft C/C++ compiler error C2705."
ms.date: 08/25/2020
f1_keywords: ["C2705"]
helpviewer_keywords: ["C2705"]
ms.assetid: 29249ea3-4ea7-4105-944b-bdb83e8d6852
---
# Compiler Error C2705

Expand All @@ -16,7 +15,7 @@ Execution jumps to a label within a **`try`**/**`catch`**, **`__try`**/**`__exce

## Example

The following sample generates C2705:
The following example generates C2705:

```cpp
// C2705.cpp
Expand Down
7 changes: 5 additions & 2 deletions docs/error-messages/compiler-errors-2/compiler-error-c2706.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ description: "Describes Microsoft C/C++ compiler error C2706."
ms.date: 08/25/2020
f1_keywords: ["C2706"]
helpviewer_keywords: ["C2706"]
ms.assetid: e18da924-c42d-4b09-8e29-f4e0382d7dc6
---
# Compiler Error C2706

> illegal `__except` without matching `__try` (missing '}' in `__try` block?)

## Remarks

The compiler did not find a closing brace for a **`__try`** block.

The following sample generates C2706:
## Example

The following example generates C2706:

```cpp
// C2706.cpp
Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2707.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2707"
title: "Compiler Error C2707"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2707"
ms.date: 11/04/2016
f1_keywords: ["C2707"]
helpviewer_keywords: ["C2707"]
ms.assetid: 3deaf45c-74da-4c9d-acc6-b82412720b74
---
# Compiler Error C2707

'identifier' : bad context for intrinsic function
> 'identifier' : bad context for intrinsic function

## Remarks

Structured exception-handling intrinsics are invalid in certain contexts:

Expand All @@ -22,7 +23,7 @@ To resolve the error, be sure that the exception-handling intrinsics are placed

## Example

The following sample generates C2707.
The following example generates C2707.

```cpp
// C2707.cpp
Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2708.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C2708"
title: "Compiler Error C2708"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2708"
ms.date: 11/04/2016
f1_keywords: ["C2708"]
helpviewer_keywords: ["C2708"]
ms.assetid: d52d3088-1141-42f4-829c-74755a7fcc3a
---
# Compiler Error C2708

'identifier' : actual parameters length in bytes differs from previous call or reference
> 'identifier' : actual parameters length in bytes differs from previous call or reference

## Remarks

A [__stdcall](../../cpp/stdcall.md) function must be preceded by a prototype. Otherwise, the compiler interprets the first call to the function as a prototype and this error occurs when the compiler encounters a call that does not match.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2709.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Error C2709"
title: "Compiler Error C2709"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2709"
ms.date: 11/04/2016
f1_keywords: ["C2709"]
helpviewer_keywords: ["C2709"]
ms.assetid: e66fc7e6-0e91-4b99-a6e0-fdb069b09fbc
---
# Compiler Error C2709

'identifier' : formal parameter's length in bytes differs from previous declaration
> 'identifier' : formal parameter's length in bytes differs from previous declaration

## Remarks

The signature in a call to the specified function differs from the prototype.
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2710.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2710"
title: "Compiler Error C2710"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2710"
ms.date: 11/04/2016
f1_keywords: ["C2710"]
helpviewer_keywords: ["C2710"]
ms.assetid: a2a6bb5b-86ad-4a6c-acd0-e2bef8464e0e
---
# Compiler Error C2710

'construct' : '__declspec(modifier)' can only be applied to a function returning a pointer
> 'construct' : '__declspec(modifier)' can only be applied to a function returning a pointer

## Remarks

A function whose return value is a pointer is the only construct to which `modifier` can be applied.

The following sample generates C2710:
## Example

The following example generates C2710:

```cpp
// C2710.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2711.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2711"
title: "Compiler Error C2711"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2711"
ms.date: 11/04/2016
f1_keywords: ["C2711"]
helpviewer_keywords: ["C2711"]
ms.assetid: 9df9f808-7419-4e63-abdd-e6538ff0871f
---
# Compiler Error C2711

'function' : this function cannot be compiled as managed, consider using #pragma unmanaged
> 'function' : this function cannot be compiled as managed, consider using #pragma unmanaged

## Remarks

Some instructions will prevent the compiler from generating MSIL for the enclosing function.

The following sample generates C2711:
## Example

The following example generates C2711:

```cpp
// C2711.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ description: "Describes Microsoft C/C++ compiler error C2712."
ms.date: 08/25/2020
f1_keywords: ["C2712"]
helpviewer_keywords: ["C2712"]
ms.assetid: f7d4ffcc-7ed2-459b-8067-a728ce647071
---
# Compiler Error C2712

Expand All @@ -30,7 +29,7 @@ The **`/clr:pure`** and **`/clr:safe`** compiler options are deprecated in Visua

## Example

The following sample generates C2712 and shows how to fix it.
The following example generates C2712 and shows how to fix it.

```cpp
// C2712.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ description: "Describes Microsoft C/C++ compiler error C2713."
ms.date: 08/25/2020
f1_keywords: ["C2713"]
helpviewer_keywords: ["C2713"]
ms.assetid: bae9bee3-b4b8-4be5-b6a5-02df587a7278
---
# Compiler Error C2713

> only one form of exception handling permitted per function

## Remarks

You can't use structured exception handling (**`__try`**/**`__except`**) and C++ exception handling (**`try`**/**`catch`**) in the same function.
9 changes: 4 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2714.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
---
description: "Learn more about: Compiler Error C2714"
title: "Compiler Error C2714"
description: "Learn more about: Compiler Error C2714"
ms.date: 07/22/2020
f1_keywords: ["C2714"]
helpviewer_keywords: ["C2714"]
ms.assetid: 401a5a42-660c-4bad-9d63-1a2d092bc489
---
# Compiler Error C2714

> `alignof(void)` is not allowed

An invalid value was passed to an operator.

## Remarks

An invalid value was passed to an operator.

See [`alignof` operator](../../cpp/alignof-operator.md) for more information.

## Example

The following sample generates C2714.
The following example generates C2714.

```cpp
// C2714.cpp
Expand Down
11 changes: 7 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c2715.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
---
description: "Learn more about: Compiler Error C2715"
title: "Compiler Error C2715"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2715"
ms.date: 11/04/2016
f1_keywords: ["C2715"]
helpviewer_keywords: ["C2715"]
ms.assetid: c81567a7-5b65-468f-aaf9-835f91e468e4
---
# Compiler Error C2715

'type' : cannot throw or catch this type
> 'type' : cannot throw or catch this type

## Remarks

Value types are not valid arguments when using exception handling in managed code (see [Exception Handling](../../extensions/exception-handling-cpp-component-extensions.md) for more information).

## Example

```cpp
// C2715a.cpp
// compile with: /clr
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2718.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2718"
title: "Compiler Error C2718"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2718"
ms.date: 11/04/2016
f1_keywords: ["C2718"]
helpviewer_keywords: ["C2718"]
ms.assetid: 78cc71f8-c142-46fc-9aed-970635d74f0c
---
# Compiler Error C2718

'parameter': actual parameter with __declspec(align('#')) won't be aligned
> 'parameter': actual parameter with __declspec(align('#')) won't be aligned

## Remarks

The [align](../../cpp/align-cpp.md) **`__declspec`** modifier is not permitted on function parameters.

The following sample generates C2718:
## Example

The following example generates C2718:

```cpp
// C2718.cpp
Expand Down
13 changes: 8 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c2719.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Error C2719"
title: "Compiler Error C2719"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C2719"
ms.date: 11/04/2016
f1_keywords: ["C2719"]
helpviewer_keywords: ["C2719"]
ms.assetid: ea6236d3-8286-45cc-9478-c84ad3dd3c8e
---
# Compiler Error C2719

'parameter': formal parameter with __declspec(align('#')) won't be aligned
> 'parameter': formal parameter with __declspec(align('#')) won't be aligned

## Remarks

The [align](../../cpp/align-cpp.md) **`__declspec`** modifier is not permitted on function parameters. Function parameter alignment is controlled by the calling convention used. For more information, see [Calling Conventions](../../cpp/calling-conventions.md).

The following sample generates C2719 and shows how to fix it:
## Example

The following example generates C2719 and shows how to fix it:

```cpp
// C2719.cpp
Expand Down
Loading