[clang] [CIR] Add decl case for template specialization (PR #143029)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 5 13:45:44 PDT 2025
================
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+template<class T>
+class X {
+public:
+ int f() { return 0; }
+};
+
+template<> class X<int> {
----------------
erichkeane wrote:
Add another test for a 'partial' specialization. There shouldn't be any additional code (since a `ClassTemplatePartialSpecializationDecl` inherits from `ClassTemplateSpecializationDecl`, but it should demonstrative.
You can do this by:
```
template<typename T, typename U>
class Templ {};
template<typename T>
class Templ<T, int>{};
Templ<int, int> t;
```
https://github.com/llvm/llvm-project/pull/143029
More information about the cfe-commits
mailing list