Skip to content

Commit 5431a31

Browse files
authored
[clang-tidy][NFC] Fix gsl::not_null template parameter (#99472)
`T` is expected to be a pointer type. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-nullptr
1 parent 507c18b commit 5431a31

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-const-or-ref-data-members.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Examples:
3535
int* x;
3636
std::unique_ptr<int> x;
3737
std::shared_ptr<int> x;
38-
gsl::not_null<int> x;
38+
gsl::not_null<int*> x;
3939
};
4040

4141
// Bad, rvalue reference member

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-const-or-ref-data-members.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct Ok {
1818
const int *pc;
1919
std::unique_ptr<int> up;
2020
std::shared_ptr<int> sp;
21-
gsl::not_null<int> n;
21+
gsl::not_null<int*> n;
2222
};
2323

2424
struct ConstMember {
@@ -60,7 +60,7 @@ struct Ok2 {
6060
const Foo *pc;
6161
std::unique_ptr<Foo> up;
6262
std::shared_ptr<Foo> sp;
63-
gsl::not_null<Foo> n;
63+
gsl::not_null<Foo*> n;
6464
};
6565

6666
struct ConstMember2 {

0 commit comments

Comments
 (0)