================
@@ -0,0 +1,38 @@
+// RUN: %check_clang_tidy -std=c++11-or-later %s
bugprone-crtp-constructor-accessibility %t -- -- -fno-delayed-template-parsing
+
+// CONSTEXPR must stay the first expansion in this file: the crash needs a file
+// entry right before it, and a macro or a split '>>' above would hide it.
+#define CONSTEXPR constexpr
+#define EMPTY_BODY {}
+
+namespace ctor_begins_and_ends_with_macro {
+template <typename T>
+class CRTP {
+public:
+ CONSTEXPR CRTP() EMPTY_BODY
+ // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: public constructor allows the
CRTP to be constructed as a regular template class; consider making it private
and declaring the derived class as friend
[bugprone-crtp-constructor-accessibility]
+ // CHECK-FIXES: private:{{[[:space:]]*}}CONSTEXPR CRTP()
EMPTY_BODY{{[[:space:]]*}}public:
----------------
your-moon wrote:
Done in 5fef8b6a1, thanks! This also tightens the test: if the newline before
`public:` is dropped, the split lines fail while the old `{{[[:space:]]*}}`
form still passed.
https://github.com/llvm/llvm-project/pull/232163
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits