Fix #23241 - duplicate deprecation message for enum member accessed by name#23283
Merged
thewilsonator merged 1 commit intoJun 18, 2026
Merged
Conversation
thewilsonator
approved these changes
Jun 18, 2026
Contributor
|
CI failures are network related. |
…sed by name A deprecated enum member accessed by its unqualified name (an anonymous enum member, a member found via `with`, or an ImportC enumerator) reported the deprecation twice: once during name resolution and again in getVarExp(), which already performs the deprecated/disabled checks itself. Skip the redundant check for enum members in the two name-resolution paths so the diagnostic is emitted exactly once.
f10ddb4 to
937cc4b
Compare
Member
Author
|
@thewilsonator I've expanded the test case. Can you review again? |
Member
Author
|
tnx for the review, Nic! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23241.
A deprecated enum member accessed by its unqualified name — an anonymous enum
member, a member found via
with, or an ImportC enumerator — reported thedeprecation twice: once during name resolution and again in
getVarExp(),which already performs the deprecated/disabled checks itself.
This skips the redundant
checkDeprecated/checkDisabledfor enum members in thetwo name-resolution paths, so the diagnostic is emitted exactly once.
New test
compilable/deprecated_enum_member.dcovers the anonymous-enum andnamed-enum cases.
Split out of #23242 per review feedback. That PR (ImportC C23
[[...]]attributes)is stacked on top of this one: its C23 enumerator-deprecation support makes a
deprecated ImportC enumerator fire this same diagnostic, so it depends on this dedup
to emit the message once rather than twice.