Skip to content

Commit c7dc836

Browse files
authored
[Clang] fix diagnostic to correctly handle singular and plural cases for redundant qualifiers on base class type (#125943)
Fixes #125942
1 parent 4562efc commit c7dc836

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def warn_qual_return_type : Warning<
490490
"'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
491491
InGroup<IgnoredQualifiers>, DefaultIgnore;
492492
def warn_qual_base_type : Warning<
493-
"'%0' qualifier%s1 on base class type %2 have no effect">,
493+
"'%0' qualifier%s1 on base class type %2 %plural{1:has|:have}1 no effect">,
494494
InGroup<IgnoredQualifiers>, DefaultIgnore;
495495

496496
def warn_deprecated_redundant_constexpr_static_def : Warning<

clang/test/SemaCXX/warn-base-type-qualifiers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ template <typename T> using add_const_t = typename add_const<T>::type;
88
class A { };
99

1010
typedef const A A_Const;
11-
class B : public A_Const { }; // expected-warning {{'const' qualifier on base class type 'A_Const' (aka 'const A') have no effect}} \
11+
class B : public A_Const { }; // expected-warning {{'const' qualifier on base class type 'A_Const' (aka 'const A') has no effect}} \
1212
// expected-note {{base class 'A_Const' (aka 'const A') specified here}}
1313

1414
typedef const volatile A A_Const_Volatile;
@@ -19,15 +19,15 @@ struct D {
1919
D(int);
2020
};
2121

22-
template <typename T> struct E : T { // expected-warning {{'const' qualifier on base class type 'const D' have no effect}} \
22+
template <typename T> struct E : T { // expected-warning {{'const' qualifier on base class type 'const D' has no effect}} \
2323
// expected-note {{base class 'const D' specified here}}
2424
using T::T;
2525
E(int &) : E(0) {}
2626
};
2727
E<const D> e(1); // expected-note {{in instantiation of template class 'E<const D>' requested here}}
2828

2929
template <typename T>
30-
struct G : add_const<T>::type { // expected-warning {{'const' qualifier on base class type 'add_const<D>::type' (aka 'const D') have no effect}} \
30+
struct G : add_const<T>::type { // expected-warning {{'const' qualifier on base class type 'add_const<D>::type' (aka 'const D') has no effect}} \
3131
// expected-note {{base class 'add_const<D>::type' (aka 'const D') specified here}}
3232
using T::T;
3333
G(int &) : G(0) {}

0 commit comments

Comments
 (0)