Skip to content

Commit f830989

Browse files
committed
test
1 parent b53538c commit f830989

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clang-tools-extra/clang-tidy/bugprone/CrtpConstructorAccessibilityCheck.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ void CrtpConstructorAccessibilityCheck::check(
164164
Diag << HintFriend;
165165
}
166166

167-
// FIXME: Test the NeedsFriend false case!
168167
diag(Ctor->getLocation(),
169168
"consider making it private%select{| and declaring the derived class "
170169
"as friend}0",

clang-tools-extra/test/clang-tidy/checkers/bugprone/crtp-constructor-accessibility.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,20 @@ class A : CRTP<A> {};
236236
class B : CRTP<B> {};
237237
} // namespace explicit_derived_friend_multiple
238238

239+
namespace no_need_for_friend {
240+
class A;
241+
242+
template <typename T>
243+
class CRTP {
244+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: the implicit default constructor of the CRTP is publicly accessible [bugprone-crtp-constructor-accessibility]
245+
// CHECK-MESSAGES: :[[@LINE-2]]:7: note: consider making it private
246+
// CHECK-FIXES: CRTP() = default;
247+
friend A;
248+
};
249+
250+
class A : CRTP<A> {};
251+
} // namespace no_need_for_friend
252+
239253
namespace no_warning {
240254
template <typename T>
241255
class CRTP

0 commit comments

Comments
 (0)