Skip to content

Commit 37ea87b

Browse files
AaronBallmantru
authored andcommitted
No longer issue pedantic warning about pre-c++2b compat
We were accidentally issuing "overloaded 'operator[]' with more than one parameter is a C++2b extension" with -pedantic because it was an ExtWarn diagnostic rather than a Warning. This corrects the diagnostic category and adds some test coverage. Fixes #61582
1 parent a70565f commit 37ea87b

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,10 @@ Bug Fixes to Attribute Support
778778

779779
Bug Fixes to C++ Support
780780
^^^^^^^^^^^^^^^^^^^^^^^^
781+
- No longer issue a pre-C++2b compatibility warning in ``-pedantic`` mode
782+
regading overloaded `operator[]` with more than one parmeter. (`#61582
783+
<https://github.com/llvm/llvm-project/issues/61582>`_)
784+
781785
- Address the thread identification problems in coroutines.
782786
(`#47177 <https://github.com/llvm/llvm-project/issues/47177>`_,
783787
`#47179 <https://github.com/llvm/llvm-project/issues/47179>`_)

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9138,8 +9138,9 @@ def err_operator_overload_static : Error<
91389138
def err_operator_overload_default_arg : Error<
91399139
"parameter of overloaded %0 cannot have a default argument">;
91409140

9141-
def ext_subscript_overload : ExtWarn<
9142-
"overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a C++2b extension">, InGroup<CXXPre2bCompat>, DefaultIgnore;
9141+
def ext_subscript_overload : Warning<
9142+
"overloaded %0 with %select{no|a defaulted|more than one}1 parameter is a "
9143+
"C++2b extension">, InGroup<CXXPre2bCompat>, DefaultIgnore;
91439144
def error_subscript_overload : Error<
91449145
"overloaded %0 cannot have %select{no|a defaulted|more than one}1 parameter before C++2b">;
91459146

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -verify -std=c++2b -pedantic %s
2+
// RUN: %clang_cc1 -verify=compat -std=c++2b -Wpre-c++2b-compat %s
3+
4+
// expected-no-diagnostics
5+
6+
struct GH61582 {
7+
// We accidentally would issue this diagnostic in pedantic mode; show that we
8+
// only issue it when enabling the compat warnings now.
9+
void operator[](int, int); // compat-warning {{overloaded 'operator[]' with more than one parameter is a C++2b extension}}
10+
};
11+

0 commit comments

Comments
 (0)