Skip to content
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: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3481.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3481"
title: "Compiler Error C3481"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3481"
ms.date: 11/04/2016
f1_keywords: ["C3481"]
helpviewer_keywords: ["C3481"]
ms.assetid: 5d09375a-5ed3-4b61-86ed-45e91fd734c7
---
# Compiler Error C3481

'var': lambda capture variable not found
> 'var': lambda capture variable not found

## Remarks

The compiler could not find the definition of a variable that you passed to the capture list of a lambda expression.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3482.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3482"
title: "Compiler Error C3482"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3482"
ms.date: 11/04/2016
f1_keywords: ["C3482"]
helpviewer_keywords: ["C3482"]
ms.assetid: bf99558e-bef4-421c-bb16-dcd9c54c1011
---
# Compiler Error C3482

'this' can only be used as a lambda capture within a non-static member function
> 'this' can only be used as a lambda capture within a non-static member function

## Remarks

You cannot pass **`this`** to the capture list of a lambda expression that is declared in a static method or a global function.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3483.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3483"
title: "Compiler Error C3483"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3483"
ms.date: 11/04/2016
f1_keywords: ["C3483"]
helpviewer_keywords: ["C3483"]
ms.assetid: 18b3a2c5-dfc9-4661-9653-08a5798474cf
---
# Compiler Error C3483

'var' is already part of the lambda capture list
> 'var' is already part of the lambda capture list

## Remarks

You passed the same variable to the capture list of a lambda expression more than one time.

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3484.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3484"
title: "Compiler Error C3484"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3484"
ms.date: 11/04/2016
f1_keywords: ["C3484"]
helpviewer_keywords: ["C3484"]
ms.assetid: 2fe847fa-f6ee-4978-bc1d-b6dc6ae906ac
---
# Compiler Error C3484

expected '->' before the return type
> expected '->' before the return type

## Remarks

You must provide `->` before the return type of a lambda expression.

### To correct this error

- Provide `->` before the return type.

## Examples
## Example

The following example generates C3484:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
description: "Learn more about: Compiler Error C3485"
title: "Compiler Error C3485"
description: "Learn more about: Compiler Error C3485"
ms.date: 06/01/2022
f1_keywords: ["C3485"]
helpviewer_keywords: ["C3485"]
ms.assetid: d67536f9-67a1-4ad9-9a94-d8bbbca3d0dc
---
# Compiler Error C3485

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3487.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3487"
title: "Compiler Error C3487"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3487"
ms.date: 11/04/2016
f1_keywords: ["C3487"]
helpviewer_keywords: ["C3487"]
ms.assetid: 39bda474-4418-4a79-98bf-2b22fa92eaaa
---
# Compiler Error C3487

'return type': all return expressions must deduce to the same type: previously it was 'return type'
> 'return type': all return expressions must deduce to the same type: previously it was 'return type'

## Remarks

A lambda must specify its return type unless it contains a single return statement. If a lambda contains multiple return statements, they must all have the same type.

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3488.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3488"
title: "Compiler Error C3488"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3488"
ms.date: 11/04/2016
f1_keywords: ["C3488"]
helpviewer_keywords: ["C3488"]
ms.assetid: 0a6fcd76-dd3b-48d7-abb3-22eccda96034
---
# Compiler Error C3488

'var' is not allowed when the default capture mode is by-reference
> 'var' is not allowed when the default capture mode is by-reference

## Remarks

When you specify that the default capture mode for a lambda expression is by-reference, you cannot pass a variable by reference to the capture clause of that expression.

Expand All @@ -22,7 +23,7 @@ When you specify that the default capture mode for a lambda expression is by-ref

- Pass the variable by value to the capture clause. (This might change the behavior of the lambda expression.)

## Examples
## Example

The following example generates C3488 because a reference to the variable `n` appears in the capture clause of a lambda expression whose default mode is by-reference:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3489.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3489"
title: "Compiler Error C3489"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3489"
ms.date: 11/04/2016
f1_keywords: ["C3489"]
helpviewer_keywords: ["C3489"]
ms.assetid: 47b58d69-459d-4499-abc7-5f0b9303d773
---
# Compiler Error C3489

'var' is required when the default capture mode is by-value
> 'var' is required when the default capture mode is by-value

## Remarks

When you specify that the default capture mode for a lambda expression is by-value, you cannot pass a variable by value to the capture clause of that expression.

Expand All @@ -22,7 +23,7 @@ When you specify that the default capture mode for a lambda expression is by-val

- Pass the variable by reference to the capture clause. (This might change the behavior of the lambda expression.)

## Examples
## Example

The following example generates C3489 variable `n` appears by value in the capture clause of a lambda expression whose default mode is by-value:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3490.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3490"
title: "Compiler Error C3490"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3490"
ms.date: 11/04/2016
f1_keywords: ["C3490"]
helpviewer_keywords: ["C3490"]
ms.assetid: 7638559a-fd06-4527-a9c1-0c8ae68b3123
---
# Compiler Error C3490

'var' cannot be modified because it is being accessed through a const object
> 'var' cannot be modified because it is being accessed through a const object

## Remarks

A lambda expression that is declared in a **`const`** method cannot modify non-mutable member data.

### To correct this error

- Remove the **`const`** modifier from your method declaration.

## Examples
## Example

The following example generates C3490 because it modifies the member variable `_i` in a **`const`** method:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3491.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3491"
title: "Compiler Error C3491"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3491"
ms.date: 11/04/2016
f1_keywords: ["C3491"]
helpviewer_keywords: ["C3491"]
ms.assetid: 7f0e71b2-46a0-4d25-bd09-6158a280f509
---
# Compiler Error C3491

'var': a by-value capture cannot be modified in a non-mutable lambda
> 'var': a by-value capture cannot be modified in a non-mutable lambda

## Remarks

A non-mutable lambda expression cannot modify the value of a variable that is captured by value.

Expand All @@ -18,7 +19,7 @@ A non-mutable lambda expression cannot modify the value of a variable that is ca

- Pass the variable by reference to the capture list of the lambda expression.

## Examples
## Example

The following example generates C3491 because the body of a non-mutable lambda expression modifies the capture variable `m`:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3492.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3492"
title: "Compiler Error C3492"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3492"
ms.date: 11/04/2016
f1_keywords: ["C3492"]
helpviewer_keywords: ["C3492"]
ms.assetid: b1dc6342-9133-4b1f-a9c3-e8c65d20d121
---
# Compiler Error C3492

'var': you cannot capture a member of an anonymous union
> 'var': you cannot capture a member of an anonymous union

## Remarks

You cannot capture a member of an unnamed union.

### To correct this error

- Give the union a name and pass the complete union structure to the capture list of the lambda expression.

## Examples
## Example

The following example generates C3492 because it captures a member of an anonymous union:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3493.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3493"
title: "Compiler Error C3493"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3493"
ms.date: 11/04/2016
f1_keywords: ["C3493"]
helpviewer_keywords: ["C3493"]
ms.assetid: 734b4257-12a3-436f-8488-c8c55ec81634
---
# Compiler Error C3493

'var' cannot be implicitly captured because no default capture mode has been specified
> 'var' cannot be implicitly captured because no default capture mode has been specified

## Remarks

The empty lambda expression capture, `[]`, specifies that the lambda expression does not explicitly or implicitly capture any variables.

Expand All @@ -18,7 +19,7 @@ The empty lambda expression capture, `[]`, specifies that the lambda expression

- Explicitly capture one or more variables.

## Examples
## Example

The following example generates C3493 because it modifies an external variable but specifies the empty capture clause:

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3495.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3495"
title: "Compiler Error C3495"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3495"
ms.date: 11/04/2016
f1_keywords: ["C3495"]
helpviewer_keywords: ["C3495"]
ms.assetid: 1fd40cb8-8373-403d-b8a8-f08424a50807
---
# Compiler Error C3495

'var': a lambda capture must have automatic storage duration
> 'var': a lambda capture must have automatic storage duration

## Remarks

You cannot capture a variable that does not have automatic storage duration, such as a variable that is marked **`static`** or **`extern`**.

Expand Down
9 changes: 5 additions & 4 deletions docs/error-messages/compiler-errors-2/compiler-error-c3496.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3496"
title: "Compiler Error C3496"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3496"
ms.date: 11/04/2016
f1_keywords: ["C3496"]
helpviewer_keywords: ["C3496"]
ms.assetid: e19885f2-677f-4c1e-bc69-e35852262dc3
---
# Compiler Error C3496

'this' is always captured by value: '&' ignored
> 'this' is always captured by value: '&' ignored

## Remarks

You cannot capture the **`this`** pointer by reference.

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3498.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Error C3498"
title: "Compiler Error C3498"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3498"
ms.date: 11/04/2016
f1_keywords: ["C3498"]
helpviewer_keywords: ["C3498"]
ms.assetid: 0a5a7817-0872-4119-83bf-980a19113374
---
# Compiler Error C3498

'var': you cannot capture a variable that has a managed or WinRTtype
> 'var': you cannot capture a variable that has a managed or WinRTtype

## Remarks

You cannot capture a variable that has a managed type or a Windows Runtime type in a lambda.

### To correct this error

- Pass the managed or Windows Runtime variable to the parameter list of the lambda expression.

## Examples
## Example

The following example generates C3498 because a variable that has a managed type appears in the capture list of a lambda expression:

Expand Down
11 changes: 6 additions & 5 deletions docs/error-messages/compiler-errors-2/compiler-error-c3499.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Error C3499"
title: "Compiler Error C3499"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Error C3499"
ms.date: 11/04/2016
f1_keywords: ["C3499"]
helpviewer_keywords: ["C3499"]
ms.assetid: 6717de5c-ae0f-4024-bdf2-b5598009e7b6
---
# Compiler Error C3499

a lambda that has been specified to have a void return type cannot return a value
> a lambda that has been specified to have a void return type cannot return a value

## Remarks

The compiler generates this error when a lambda expression that specifies **`void`** as the return type returns a value; or when a lambda expression contains more than one statement and returns a value, but does not specify its return type.

Expand All @@ -20,7 +21,7 @@ The compiler generates this error when a lambda expression that specifies **`voi

- Combine the statements that make up the body of the lambda expression into a single statement.

## Examples
## Example

The following example generates C3499 because the body of a lambda expression contains multiple statements and returns a value, but the lambda expression does not specify the return type:

Expand Down
Loading