다음을 통해 공유


컴파일러 오류 C2323

'identifier': 멤버가 아닌 연산 new 자 또는 delete 함수를 선언하거나 전역 네임스페이스 이외의 네임스페이스에 선언 static 할 수 없습니다.

오버로드 연산자는 new 비정적이어야 하며 delete 전역 네임스페이스 또는 클래스 멤버로 정의되어야 합니다.

다음은 C2323을 생성합니다.

// C2323.cpp
// compile with: /c
static void* operator new(size_t);   // C2323 since static
static void operator delete(void*);  // C2323 since static

namespace NS
{
    void* operator new(size_t);   // C2323 since not defined in the global namespace
    void operator delete(void*);  // C2323 since not defined in the global namespace
}

참고 항목

newdelete 연산자