Skip to content

Commit 7e42d5c

Browse files
Merge pull request #5693 from Rageking8/update-c2182-error-reference
Update C2182 error reference
2 parents 8ec33a1 + c55580a commit 7e42d5c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
title: "Compiler Error C2182"
33
description: "Learn more about: Compiler Error C2182"
4-
ms.date: 11/04/2016
4+
ms.date: 08/22/2025
55
f1_keywords: ["C2182"]
66
helpviewer_keywords: ["C2182"]
77
---
88
# Compiler Error C2182
99

10-
> 'identifier' : illegal use of type 'void'
10+
> '*identifier*': this use of 'void' is not valid
1111
1212
## Remarks
1313

14-
A variable is declared type **`void`**.
14+
You can't create a variable or array of type **`void`**. Only pointers to **`void`** are allowed.
1515

1616
## Example
1717

@@ -20,9 +20,9 @@ The following example generates C2182:
2020
```cpp
2121
// C2182.cpp
2222
// compile with: /c
23-
int main() {
24-
int i = 10;
25-
void &ir = i; // C2182 cannot have a reference to type void
26-
int &ir = i; // OK
27-
}
23+
24+
void var; // C2182
25+
void arr[5]; // C2182
26+
27+
void* ptr; // OK
2828
```

docs/error-messages/compiler-errors-1/compiler-errors-c2100-through-c2199.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler errors C2100 through C2199"
33
description: "Learn more about: Compiler errors C2100 through C2199"
4-
ms.date: "04/21/2019"
4+
ms.date: 04/21/2019
55
f1_keywords: ["C2119", "C2123", "C2125", "C2126", "C2127", "C2136", "C2176", "C2187", "C2189"]
66
helpviewer_keywords: ["C2119", "C2123", "C2125", "C2126", "C2127", "C2136", "C2176", "C2187", "C2189"]
77
---
@@ -97,7 +97,7 @@ The articles in this section of the documentation explain a subset of the error
9797
|[Compiler error C2179](compiler-error-c2179.md)|'*type*': an attribute argument cannot use type parameters|
9898
|[Compiler error C2180](compiler-error-c2180.md)|controlling expression has type '*type*'|
9999
|[Compiler error C2181](compiler-error-c2181.md)|illegal else without matching if|
100-
|[Compiler error C2182](compiler-error-c2182.md)|'*identifier*': illegal use of type 'void'|
100+
|[Compiler error C2182](compiler-error-c2182.md)|'*identifier*': this use of 'void' is not valid|
101101
|[Compiler error C2183](compiler-error-c2183.md)|syntax error: translation unit is empty|
102102
|[Compiler error C2184](compiler-error-c2184.md)|'*type*': illegal type for __except expression|
103103
|[Compiler error C2185](compiler-error-c2185.md)|'*identifier*': illegal based allocation|

0 commit comments

Comments
 (0)