You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scope of a local constant is the block in which the declaration occurs. It is an error to refer to a local constant in a textual position that precedes the end of its constant_declarator.
But const string s = nameof(s); is fine, despite the reference in nameof(s) being before the end of the declarator.
It's possible that we just need a carve-out for nameof in this case.
The text was updated successfully, but these errors were encountered:
jskeet
added
the
type: bug
The Standard does not describe the language as intended or implemented
label
May 16, 2024
Spotted in #608 by @KalleOlaviNiemitalo, but split off as it's not part of the change.
In statements.md:
But
const string s = nameof(s);
is fine, despite the reference innameof(s)
being before the end of the declarator.It's possible that we just need a carve-out for nameof in this case.
The text was updated successfully, but these errors were encountered: