diff --git a/docs/error-messages/compiler-errors-1/compiler-error-c2277.md b/docs/error-messages/compiler-errors-1/compiler-error-c2277.md index 1f56b60b30..c5e73e52a4 100644 --- a/docs/error-messages/compiler-errors-1/compiler-error-c2277.md +++ b/docs/error-messages/compiler-errors-1/compiler-error-c2277.md @@ -1,17 +1,17 @@ --- title: "Compiler Error C2277" description: "Learn more about: Compiler Error C2277" -ms.date: 11/04/2016 +ms.date: 08/27/2025 f1_keywords: ["C2277"] helpviewer_keywords: ["C2277"] --- # Compiler Error C2277 -> 'identifier' : cannot take address of this member function +> '*function*': cannot take address of this member function ## Remarks -You cannot take the address of a member function. +You cannot take the address of a [constructor](../../cpp/constructors-cpp.md) or [destructor](../../cpp/destructors-cpp.md). For more information, see [Address-of operator: `&`](../../cpp/address-of-operator-amp.md) and [Pointers to Members](../../cpp/pointers-to-members.md). ## Example @@ -19,9 +19,14 @@ The following example generates C2277: ```cpp // C2277.cpp -class A { -public: - A(); +// compile with: /c + +struct S +{ + S() {} + ~S() {} }; -(*pctor)() = &A::A; // C2277 + +void (S::* pointer_to_constructor)() = &S::S; // C2277 +void (S::* pointer_to_destructor)() = &S::~S; // C2277 ```