[clang-tools-extra] [clang-tidy] Fix failing test after 17f0680f69f44d340fd0205f7763b2830357c0d5 (PR #81171)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 8 10:46:47 PST 2024


https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/81171

The following test case in `clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp` is failing:
```cpp
#ifdef PR64602 // Should not crash
template <class T = void>
struct S
{
    auto foo(auto);
};

template <>
auto S<>::foo(auto)
{
    return 1;
}
// CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error]
#endif
```

#80864 fixes a bug where we would (incorrectly) append invented template parameters to empty template parameter lists, which causes this test to fail.

 

>From 5975cd1e5214c18b98ad10ca7100b9f8ba5feb91 Mon Sep 17 00:00:00 2001
From: Krystian Stasiowski <sdkrystian at gmail.com>
Date: Thu, 8 Feb 2024 13:42:38 -0500
Subject: [PATCH] [clang-tidy] Fix failing test after
 17f0680f69f44d340fd0205f7763b2830357c0d5

---
 .../test/clang-tidy/infrastructure/diagnostic.cpp              | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
index 547f634a101c5..d0efc5ca76375 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp
@@ -68,5 +68,6 @@ auto S<>::foo(auto)
 {
     return 1;
 }
-// CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error]
+// CHECK8: error: conflicting types for 'foo' [clang-diagnostic-error]
+// CHECK8: note: previous declaration is here
 #endif



More information about the cfe-commits mailing list