diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2322.md b/docs/error-messages/compiler-errors-1/compiler-error-c2322.md index 3118e5213b..fb2482086a 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2322.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2322.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2322" title: "Compiler Error C2322" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2322" +ms.date: 11/04/2016 f1_keywords: ["C2322"] helpviewer_keywords: ["C2322"] -ms.assetid: f9b92005-618a-42d8-80e9-67ce769a9f3b --- # Compiler Error C2322 -'identifier' : address of dllimport 'dllimport' is not static +> 'identifier' : address of dllimport 'dllimport' is not static + +## Remarks A nonstatic value is given as the address of a function declared with `dllimport`. diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2323.md b/docs/error-messages/compiler-errors-1/compiler-error-c2323.md index d17cf401d9..1c00da8350 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2323.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2323.md @@ -1,16 +1,20 @@ --- title: "Compiler Error C2323" description: "Learn more about: Compiler Error C2323" -ms.date: "03/20/2024" +ms.date: 03/20/2024 f1_keywords: ["C2323"] helpviewer_keywords: ["C2323"] --- # Compiler Error C2323 -'identifier': non-member operator `new` or `delete` functions may not be declared `static` or in a namespace other than the global namespace. +> 'identifier': non-member operator `new` or `delete` functions may not be declared `static` or in a namespace other than the global namespace. + +## Remarks The `new` and `delete` overload operators must be non-static, defined in the global namespace or as class members. +## Example + The following generates C2323: ```cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2324.md b/docs/error-messages/compiler-errors-1/compiler-error-c2324.md index d1ef4836f5..fcb0fd61a1 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2324.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2324.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2324" title: "Compiler Error C2324" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2324" +ms.date: 11/04/2016 f1_keywords: ["C2324"] helpviewer_keywords: ["C2324"] -ms.assetid: 215f0544-85b0-452d-825f-17a388b6a61c --- # Compiler Error C2324 -'identifier' : unexpected to the right of 'name' +> 'identifier' : unexpected to the right of 'name' + +## Remarks A destructor is called using an incorrect identifier. -The following sample generates C2324: +## Example + +The following example generates C2324: ```cpp // C2324.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2325.md b/docs/error-messages/compiler-errors-1/compiler-error-c2325.md index 4085db3ee9..4864fe0c51 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2325.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2325.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2325" title: "Compiler Error C2325" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2325" +ms.date: 11/04/2016 f1_keywords: ["C2325"] helpviewer_keywords: ["C2325"] -ms.assetid: e6b0a186-3f2a-4adf-beae-fadd75492bf7 --- # Compiler Error C2325 -'type' : unexpected type to the right of 'name' +> 'type' : unexpected type to the right of 'name' + +## Remarks A call is made to a destructor of incorrect type. -The following sample generates C2325: +## Example + +The following example generates C2325: ```cpp // C2325.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2326.md b/docs/error-messages/compiler-errors-1/compiler-error-c2326.md index ba0c0c0112..5168287dac 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2326.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2326.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Error C2326" title: "Compiler Error C2326" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2326" +ms.date: 11/04/2016 f1_keywords: ["C2326"] helpviewer_keywords: ["C2326"] -ms.assetid: 01a5ea40-de83-4e6f-a4e8-469f441258e0 --- # Compiler Error C2326 -'declarator' : function cannot access 'name' +> 'declarator' : function cannot access 'name' + +## Remarks The code tries to modify a member variable, which is not possible. ## Example -The following sample generates C2326: +The following example generates C2326: ```cpp // C2326.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2327.md b/docs/error-messages/compiler-errors-1/compiler-error-c2327.md index 1a2c9cb18a..204783d6cb 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2327.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2327.md @@ -1,20 +1,23 @@ --- -description: "Learn more about: Compiler Error C2327" title: "Compiler Error C2327" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2327" +ms.date: 11/04/2016 f1_keywords: ["C2327"] helpviewer_keywords: ["C2327"] -ms.assetid: 95278c95-d1f9-4487-ad27-53311f5e8112 --- # Compiler Error C2327 -'symbol' : is not a type name, static, or enumerator +> 'symbol' : is not a type name, static, or enumerator + +## Remarks Code within a nested class attempts to access a member of the enclosing class that is not a type name, a static member, or an enumerator. When compiling with **/clr**, a common cause for C2327 is a property with the same name as the property type. -The following sample generates C2327: +## Examples + +The following example generates C2327: ```cpp // C2327.cpp @@ -62,7 +65,7 @@ struct B { }; ``` -The following sample generates C2327: +The following example generates C2327: ```cpp // C2327d.cpp @@ -96,7 +99,7 @@ namespace NA { } ``` -The following sample shows C2327 when a property has the same name as the property type: +The following example shows C2327 when a property has the same name as the property type: ```cpp // C2327f.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2332.md b/docs/error-messages/compiler-errors-1/compiler-error-c2332.md index 90d950d546..8ff2d139da 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2332.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2332.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2332" title: "Compiler Error C2332" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2332" +ms.date: 11/04/2016 f1_keywords: ["C2332"] helpviewer_keywords: ["C2332"] -ms.assetid: fb05cd68-e271-4bea-9fb7-ef4edb0a26ac --- # Compiler Error C2332 -'typedef' : missing tag name +> 'typedef' : missing tag name + +## Remarks The compiler found an incomplete type definition. -The following sample generates C2332: +## Example + +The following example generates C2332: ```cpp // C2332.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2333.md b/docs/error-messages/compiler-errors-1/compiler-error-c2333.md index b1be3f36fc..ef87be83da 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2333.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2333.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2333" title: "Compiler Error C2333" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2333" +ms.date: 11/04/2016 f1_keywords: ["C2333"] helpviewer_keywords: ["C2333"] -ms.assetid: 2636fc1e-d3e7-4e68-8628-3c81a99ba813 --- # Compiler Error C2333 -'function' : error in function declaration; skipping function body +> 'function' : error in function declaration; skipping function body + +## Remarks This error occurs after another error, for member functions defined inside their class. -The following sample generates C2333: +## Example + +The following example generates C2333: ```cpp // C2333.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2334.md b/docs/error-messages/compiler-errors-1/compiler-error-c2334.md index 0ba710e94a..83f01fe91e 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2334.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2334.md @@ -1,16 +1,17 @@ --- -description: "Learn more about: Compiler Error C2334" title: "Compiler Error C2334" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2334" +ms.date: 11/04/2016 f1_keywords: ["C2334"] helpviewer_keywords: ["C2334"] -ms.assetid: 36142855-e00b-4bbf-80f5-a301edeff46e --- # Compiler Error C2334 -unexpected token(s) preceding ': or {'; skipping apparent function body +> unexpected token(s) preceding ': or {'; skipping apparent function body + +## Example -The following sample generates C2334. This error occurs after error C2059: +The following example generates C2334. This error occurs after error C2059: ```cpp // C2334.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2337.md b/docs/error-messages/compiler-errors-1/compiler-error-c2337.md index ca4fe6be89..9f5f6c9149 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2337.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2337.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2337" title: "Compiler Error C2337" -ms.date: "09/19/2019" +description: "Learn more about: Compiler Error C2337" +ms.date: 09/19/2019 f1_keywords: ["C2337"] helpviewer_keywords: ["C2337"] -ms.assetid: eccc9178-a15e-42cd-bbd0-3cea7cf2d55b --- # Compiler Error C2337 > '*attribute-name*' : attribute not found +## Remarks + Your code uses an attribute that isn't supported in this context. Or, the attribute isn't available in this version of the compiler. To resolve this issue, remove the unsupported attribute. -The following sample generates C2337: +## Example + +The following example generates C2337: ```cpp // C2337.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2338.md b/docs/error-messages/compiler-errors-1/compiler-error-c2338.md index 1ab34e8a9b..db9b460f46 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2338.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2338.md @@ -1,15 +1,16 @@ --- -description: "Learn more about: Compiler Error C2338" title: "Compiler Error C2338" +description: "Learn more about: Compiler Error C2338" ms.date: 02/22/2022 f1_keywords: ["C2338"] helpviewer_keywords: ["C2338"] -ms.assetid: 49bba575-1de4-4963-86c6-ce3226a2ba51 --- # Compiler Error C2338 > *Error message* +## Remarks + Error C2338 can be caused by a **`static_assert`** error during compilation. The message is supplied by the **`static_assert`** parameters. Error C2338 can also be generated by external providers to the compiler. In most cases, these errors are reported by an attribute provider DLL, such as ATLPROV. Some common forms of this message include: @@ -24,6 +25,8 @@ These errors are often unrecoverable, and may be followed by a fatal compiler er To fix these issues, correct the attribute usage. For example, in some cases, attribute parameters must be declared before they can be used. If an ATL error number is provided, check the documentation for that error for more specific information. +## Example + In Standard C++11 and later, **`constexpr`** functions are no longer considered **`noexcept`** by default when used in a constant expression. This behavior change comes from the resolution of Core Working Group (CWG) [CWG 1351](https://wg21.link/cwg1351) and is enabled in [`/permissive-`](../../build/reference/permissive-standards-conformance.md) mode. The following example compiles in Visual Studio 2019 version 16.1 and earlier, but produces C2338 in Visual Studio 2019 version 16.2: ```cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2341.md b/docs/error-messages/compiler-errors-1/compiler-error-c2341.md index 74f459a7bf..3fe4850bb8 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2341.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2341.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2341" title: "Compiler Error C2341" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2341" +ms.date: 11/04/2016 f1_keywords: ["C2341"] helpviewer_keywords: ["C2341"] -ms.assetid: aa2a7da5-e1c8-4225-9939-5bdc50158f31 --- # Compiler Error C2341 -'section name' : segment must be defined using #pragma data_seg, code_seg or section prior to use +> 'section name' : segment must be defined using #pragma data_seg, code_seg or section prior to use + +## Remarks An [allocate](../../cpp/allocate.md) statement refers to a segment not yet defined by [code_seg](../../preprocessor/code-seg.md), [data_seg](../../preprocessor/data-seg.md), or [section](../../preprocessor/section.md) pragmas. -The following sample generates C2341: +## Example + +The following example generates C2341: ```cpp // C2341.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2344.md b/docs/error-messages/compiler-errors-1/compiler-error-c2344.md index 4fb3b3f2f7..978a21fe0f 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2344.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2344.md @@ -1,17 +1,20 @@ --- -description: "Learn more about: Compiler Error C2344" title: "Compiler Error C2344" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2344" +ms.date: 11/04/2016 f1_keywords: ["C2344"] helpviewer_keywords: ["C2344"] -ms.assetid: a84c7b37-c84e-4345-8691-c23abb2dc193 --- # Compiler Error C2344 -align(#) : alignment must be power of two +> align(#) : alignment must be power of two + +## Remarks When using the [align](../../cpp/align-cpp.md) keyword, the value you pass must be a power of two. +## Example + For example, the following code generates C2344 because 3 is not a power of two: ```cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2345.md b/docs/error-messages/compiler-errors-1/compiler-error-c2345.md index 4044e32b0e..6d621a6d8c 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2345.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2345.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2345" title: "Compiler Error C2345" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2345" +ms.date: 11/04/2016 f1_keywords: ["C2345"] helpviewer_keywords: ["C2345"] -ms.assetid: e1cc88b0-0223-4d07-975b-fa99956a82bd --- # Compiler Error C2345 -align(value) : illegal alignment value +> align(value) : illegal alignment value + +## Remarks You passed a value to the [align](../../cpp/align-cpp.md) keyword that is outside the allowable range. -The following sample generates C2345: +## Example + +The following example generates C2345: ```cpp // C2345.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2346.md b/docs/error-messages/compiler-errors-1/compiler-error-c2346.md index 6c26eabe75..b4a03aaf13 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2346.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2346.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Error C2346" title: "Compiler Error C2346" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2346" +ms.date: 11/04/2016 f1_keywords: ["C2346"] helpviewer_keywords: ["C2346"] -ms.assetid: 246145be-5645-4cd6-867c-e3bc39e33dca --- # Compiler Error C2346 -'function' cannot be compiled as native: reason +> 'function' cannot be compiled as native: reason + +## Remarks The compiler was unable to compile a function to MSIL. @@ -22,7 +23,7 @@ For more information, see [managed, unmanaged](../../preprocessor/managed-unmana ## Example -The following sample generates C2346. +The following example generates C2346. ```cpp // C2346.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2348.md b/docs/error-messages/compiler-errors-1/compiler-error-c2348.md index 66e3378836..f2d45f255d 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2348.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2348.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Error C2348" title: "Compiler Error C2348" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2348" +ms.date: 11/04/2016 f1_keywords: ["C2348"] helpviewer_keywords: ["C2348"] -ms.assetid: 4c4d701f-ccf1-46fe-9ddb-3f341684f269 --- # Compiler Error C2348 -'type name' : is not a C-style aggregate, cannot be exported in embedded-IDL +> 'type name' : is not a C-style aggregate, cannot be exported in embedded-IDL + +## Remarks To place a **`struct`** in a .idl file with the [export](../../windows/attributes/export.md) attribute, the **`struct`** must contain only data. -The following sample generates C2348: +## Example + +The following example generates C2348: ```cpp // C2348.cpp diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2350.md b/docs/error-messages/compiler-errors-1/compiler-error-c2350.md index f4ba948e01..8d4160dde2 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2350.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2350.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Error C2350" title: "Compiler Error C2350" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Error C2350" +ms.date: 11/04/2016 f1_keywords: ["C2350"] helpviewer_keywords: ["C2350"] -ms.assetid: 3a50cb94-8ced-4df4-b602-c48916fa957d --- # Compiler Error C2350 -'identifier' is not a static member +> 'identifier' is not a static member + +## Remarks Nonstatic members of a class or structure cannot be defined.