dotnet / dotnet/csharpstandard
13.2 End points and reachability: variable declaration reachability
Open
type: bug
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
It looks like we are missing _variable declaration_ exception from a list of specially handled statements in 14.2.
Consider
``` csharp
static class Program
{
static void Main(string[] args)
{
goto L;
int v; // CSC reports a warning Unreachable code detected here
L:
v = 1;
}
}
```
Proposal:
Add a new text block to section 14.2, possibly before "The block of a function member is always considered reachable"
> The local variable declaration and local constant declaration are always considered reachable.
Contributor guide
Assessment
This issue has not been assessed yet.