dotnet / dotnet/csharpstandard

Reserved member names for non-methods

Open
#1,307 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

**Describe the bug**

C# 7 section 15.3.10.1 (Reserved member names / General) says

> It is a compile-time error for a program to declare a member whose signature matches a signature reserved by a member declared in the same scope, even if […]

But it should also be a compile-time error if the program declares a non-method member whose name matches such a reserved name, even though the signature won't match then.

**Example**

```csharp
class C {
~C() {}

struct Finalize {};
}
```

**Expected behavior**

This should be a compile-time error.

**Additional context**

Inspired by .

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.