| title | Compiler Error C2277 | |
|---|---|---|
| description | Learn more about: Compiler Error C2277 | |
| ms.date | 08/27/2025 | |
| f1_keywords |
|
|
| helpviewer_keywords |
|
'function': cannot take address of this member function
You cannot take the address of a constructor or destructor. For more information, see Address-of operator: & and Pointers to Members.
The following example generates C2277:
// C2277.cpp
// compile with: /c
struct S
{
S() {}
~S() {}
};
void (S::* pointer_to_constructor)() = &S::S; // C2277
void (S::* pointer_to_destructor)() = &S::~S; // C2277