Skip to content

Commit e82960a

Browse files
authored
Document C2323
1 parent bcfad35 commit e82960a

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Compiler Error C2323"
3+
description: "Learn more about: Compiler Error C2323"
4+
ms.date: "03/20/2024"
5+
f1_keywords: ["C2323"]
6+
helpviewer_keywords: ["C2323"]
7+
---
8+
# Compiler Error C2323
9+
10+
'identifier': non-member operator new or delete functions may not be declared static or in a namespace other than the global namespace
11+
12+
Overloads for the `new` and `delete` operators must be defined as non-static in the global namespace or as a class member function.
13+
14+
The following sample generates C2323:
15+
16+
```cpp
17+
// C2323.cpp
18+
// compile with: /c
19+
static void* operator new(size_t); // C2323
20+
static void operator delete(void*); // C2323
21+
22+
namespace NS
23+
{
24+
void* operator new(size_t); // C2323
25+
void operator delete(void*); // C2323
26+
}
27+
```
28+
29+
## See also
30+
31+
[`new` and `delete` operators](../../cpp/new-and-delete-operators.md)

docs/error-messages/compiler-errors-1/compiler-errors-c2300-through-c2399.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
description: "Learn more about: Compiler errors C2300 Through C2399"
33
title: "Compiler errors C2300 Through C2399"
44
ms.date: "04/21/2019"
5-
f1_keywords: ["C2303", "C2304", "C2305", "C2306", "C2314", "C2321", "C2323", "C2328", "C2329", "C2330", "C2331", "C2335", "C2336", "C2339", "C2340", "C2342", "C2343", "C2347", "C2354", "C2358", "C2359", "C2363", "C2366", "C2367", "C2398", "C2399"]
6-
helpviewer_keywords: ["C2303", "C2304", "C2305", "C2306", "C2314", "C2321", "C2323", "C2328", "C2329", "C2330", "C2331", "C2335", "C2336", "C2339", "C2340", "C2342", "C2343", "C2347", "C2354", "C2358", "C2359", "C2363", "C2366", "C2367", "C2398", "C2399"]
7-
ms.assetid: 07ca45b5-b2f0-4049-837b-40a7a3caed88
5+
f1_keywords: ["C2303", "C2304", "C2305", "C2306", "C2314", "C2321", "C2328", "C2329", "C2330", "C2331", "C2335", "C2336", "C2339", "C2340", "C2342", "C2343", "C2347", "C2354", "C2358", "C2359", "C2363", "C2366", "C2367", "C2398", "C2399"]
6+
helpviewer_keywords: ["C2303", "C2304", "C2305", "C2306", "C2314", "C2321", "C2328", "C2329", "C2330", "C2331", "C2335", "C2336", "C2339", "C2340", "C2342", "C2343", "C2347", "C2354", "C2358", "C2359", "C2363", "C2366", "C2367", "C2398", "C2399"]
87
---
98
# Compiler errors C2300 Through C2399
109

@@ -39,7 +38,7 @@ The articles in this section of the documentation explain a subset of the error
3938
|[Compiler error C2320](compiler-error-c2320.md)|expected ':' to follow access specifier '*specifier*'|
4039
|Compiler error C2321|'*identifier*' is a keyword, and cannot be used in this context|
4140
|[Compiler error C2322](compiler-error-c2322.md)|'*identifier*': address of dllimport '*identifier*' is not static|
42-
|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|
41+
|[Compiler error C2323](compiler-error-c2323.md)|'*identifier*': non-member operator new or delete functions may not be declared static or in a namespace other than the global namespace|
4342
|[Compiler error C2324](compiler-error-c2324.md)|'*identifier*': unexpected to the right of '::~'|
4443
|[Compiler error C2325](compiler-error-c2325.md)|'*type1*': unexpected type to the right of '->~': expected '*type2*'|
4544
|[Compiler error C2326](compiler-error-c2326.md)|'*declarator*': function cannot access '*identifier*'|

docs/error-messages/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,8 @@ items:
931931
href: compiler-errors-1/compiler-error-c2320.md
932932
- name: Compiler error C2322
933933
href: compiler-errors-1/compiler-error-c2322.md
934+
- name: Compiler error C2323
935+
href: compiler-errors-1/compiler-error-c2323.md
934936
- name: Compiler error C2324
935937
href: compiler-errors-1/compiler-error-c2324.md
936938
- name: Compiler error C2325

0 commit comments

Comments
 (0)