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) {
8181}
8282
8383void 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 ())));
8888
8989 const auto ConstReference = hasType (references (isConstQualified ()));
9090 const auto RValueReference = hasType (
Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ Changes in existing checks
146146 `AllowedTypes `, that excludes specified types from const-correctness
147147 checking and fixing false positives when modifying variant by ``operator[] ``
148148 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.
150151
151152- Improved :doc: `misc-redundant-expression
152153 <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() {
10071007 x[T{}] = 3 ;
10081008}
10091009} // 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