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
16 changes: 8 additions & 8 deletions docs/error-messages/compiler-errors-1/compiler-error-c2182.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
title: "Compiler Error C2182"
description: "Learn more about: Compiler Error C2182"
ms.date: 11/04/2016
ms.date: 08/22/2025
f1_keywords: ["C2182"]
helpviewer_keywords: ["C2182"]
---
# Compiler Error C2182

> 'identifier' : illegal use of type 'void'
> '*identifier*': this use of 'void' is not valid

## Remarks

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

## Example

Expand All @@ -20,9 +20,9 @@ The following example generates C2182:
```cpp
// C2182.cpp
// compile with: /c
int main() {
int i = 10;
void &ir = i; // C2182 cannot have a reference to type void
int &ir = i; // OK
}

void var; // C2182
void arr[5]; // C2182

void* ptr; // OK
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Compiler errors C2100 through C2199"
description: "Learn more about: Compiler errors C2100 through C2199"
ms.date: "04/21/2019"
ms.date: 04/21/2019
f1_keywords: ["C2119", "C2123", "C2125", "C2126", "C2127", "C2136", "C2176", "C2187", "C2189"]
helpviewer_keywords: ["C2119", "C2123", "C2125", "C2126", "C2127", "C2136", "C2176", "C2187", "C2189"]
---
Expand Down Expand Up @@ -97,7 +97,7 @@ The articles in this section of the documentation explain a subset of the error
|[Compiler error C2179](compiler-error-c2179.md)|'*type*': an attribute argument cannot use type parameters|
|[Compiler error C2180](compiler-error-c2180.md)|controlling expression has type '*type*'|
|[Compiler error C2181](compiler-error-c2181.md)|illegal else without matching if|
|[Compiler error C2182](compiler-error-c2182.md)|'*identifier*': illegal use of type 'void'|
|[Compiler error C2182](compiler-error-c2182.md)|'*identifier*': this use of 'void' is not valid|
|[Compiler error C2183](compiler-error-c2183.md)|syntax error: translation unit is empty|
|[Compiler error C2184](compiler-error-c2184.md)|'*type*': illegal type for __except expression|
|[Compiler error C2185](compiler-error-c2185.md)|'*identifier*': illegal based allocation|
Expand Down