diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2182.md b/docs/error-messages/compiler-errors-1/compiler-error-c2182.md index 86a4d0259c6..cbe5f56228d 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2182.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2182.md @@ -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 @@ -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 ``` diff --git a/docs/error-messages/compiler-errors-1/compiler-errors-c2100-through-c2199.md b/docs/error-messages/compiler-errors-1/compiler-errors-c2100-through-c2199.md index ef2e8e4b3f9..8d5db1ea8a4 100644 --- a/docs/error-messages/compiler-errors-1/compiler-errors-c2100-through-c2199.md +++ b/docs/error-messages/compiler-errors-1/compiler-errors-c2100-through-c2199.md @@ -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"] --- @@ -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|