Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ungrammatical warning message "const qualifier have no effect" #125942

Closed
a-tarasyuk opened this issue Feb 5, 2025 · 0 comments · Fixed by #125943
Closed

Ungrammatical warning message "const qualifier have no effect" #125942

a-tarasyuk opened this issue Feb 5, 2025 · 0 comments · Fixed by #125943
Assignees
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@a-tarasyuk
Copy link
Member

https://godbolt.org/z/rT9zjMhe1

struct A {};
using CA = const A;
struct B : CA {};

Clang trunk prints:

warning: 'const' qualifier on base class type 'CA' (aka 'const A') have no effect [-Wignored-qualifiers]

Of course this should say has no effect, not have no effect.

The culprit is obvious from the source code:

def warn_qual_return_type : Warning<
  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
  InGroup<IgnoredQualifiers>, DefaultIgnore;
def warn_qual_base_type : Warning<
  "'%0' qualifier%s1 on base class type %2 have no effect">,
  InGroup<IgnoredQualifiers>, DefaultIgnore;
The latter says "have" when it should say "%plural{1:has|:have}1".

Quuxplusone#46

@a-tarasyuk a-tarasyuk added the clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer label Feb 5, 2025
@a-tarasyuk a-tarasyuk self-assigned this Feb 5, 2025
Icohedron pushed a commit to Icohedron/llvm-project that referenced this issue Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
1 participant