Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions docs/error-messages/compiler-errors-1/compiler-error-c2277.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
---
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

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
```