[clang-tools-extra] 5656927 - [clang-tidy][NFC] Add `modernize-type-traits` test case to verify issue #179386 was fixed (#182407)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 09:28:47 PST 2026
Author: Victor Chernyakin
Date: 2026-02-20T10:28:42-07:00
New Revision: 56569270b5f2deeadb568649ea1bf7fa1b3afcb0
URL: https://github.com/llvm/llvm-project/commit/56569270b5f2deeadb568649ea1bf7fa1b3afcb0
DIFF: https://github.com/llvm/llvm-project/commit/56569270b5f2deeadb568649ea1bf7fa1b3afcb0.diff
LOG: [clang-tidy][NFC] Add `modernize-type-traits` test case to verify issue #179386 was fixed (#182407)
#179386 was indirectly fixed by #170953, and this PR just adds a test
case to confirm it was indeed fixed.
Added:
Modified:
clang-tools-extra/test/clang-tidy/checkers/modernize/type-traits.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/type-traits.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/type-traits.cpp
index e5de9e33bccd9..2b2c8e97c3d3b 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/modernize/type-traits.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/type-traits.cpp
@@ -150,3 +150,17 @@ struct ImplicitlyInstantiatedConstructor {
const ImplicitlyInstantiatedConstructor<int> ImplicitInstantiation(std::remove_reference<int>::type(123));
// CHECK-MESSAGES: :[[@LINE-1]]:68: warning: use c++14 style type templates
// CHECK-FIXES: const ImplicitlyInstantiatedConstructor<int> ImplicitInstantiation(std::remove_reference_t<int>(123));
+
+#if __cplusplus >= 202002L
+
+template <typename T>
+struct S {
+ typename std::remove_reference<T>::type a; // NOLINT
+};
+
+void f() {
+ auto [a] = S<int>{};
+ [&] { a; }; // This used to cause a false positive.
+}
+
+#endif // __cplusplus >= 202002L
More information about the cfe-commits
mailing list