File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,10 @@ void ConstCorrectnessCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
81
81
}
82
82
83
83
void ConstCorrectnessCheck::registerMatchers (MatchFinder *Finder) {
84
- const auto ConstType = hasType (
85
- qualType (isConstQualified (),
86
- // pointee check will check the const pointer and const array
87
- unless ( pointerType ()), unless (arrayType ())));
84
+ const auto ConstType =
85
+ hasType ( qualType (isConstQualified (),
86
+ // pointee check will check the constness of pointer
87
+ unless (pointerType ())));
88
88
89
89
const auto ConstReference = hasType (references (isConstQualified ()));
90
90
const auto RValueReference = hasType (
Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ Changes in existing checks
146
146
`AllowedTypes `, that excludes specified types from const-correctness
147
147
checking and fixing false positives when modifying variant by ``operator[] ``
148
148
with template in parameters and supporting to check pointee mutation by
149
- `AnalyzePointers ` option.
149
+ `AnalyzePointers ` option and fixing false positives when using const array
150
+ type.
150
151
151
152
- Improved :doc: `misc-redundant-expression
152
153
<clang-tidy/checks/misc/redundant-expression>` check by providing additional
Original file line number Diff line number Diff line change @@ -1007,3 +1007,11 @@ template <typename T> void f() {
1007
1007
x[T{}] = 3 ;
1008
1008
}
1009
1009
} // namespace gh127776_false_positive
1010
+
1011
+ namespace gh132931_false_positive {
1012
+ using T = const int ;
1013
+ void valid (int i) {
1014
+ const int arr0[] = {1 , 2 , 3 };
1015
+ T arr1[] = {1 , 2 , 3 };
1016
+ }
1017
+ } // namespace gh132931_false_positive
You can’t perform that action at this time.
0 commit comments