Skip to content

Commit 3aa3929

Browse files
committed
feat: allow template specialization
1 parent efd185f commit 3aa3929

14 files changed

+123
-7
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
t: @struct <T: type> type = {
2+
a: i32 = 1;
3+
}
4+
t: @struct <T: type> specialize<T> type requires std::is_void_v<T> = {
5+
b: i32 = 2;
6+
}
7+
t: @struct specialize<i64> type = {
8+
c: i32 = 3;
9+
}
10+
v: <T> const i32 = 1;
11+
v: <> specialize<void> const i32 = 2;
12+
main: () = {
13+
[[assert Testing: t<i32>().a == 1]]
14+
[[assert Testing: t<void>().b == 2]]
15+
[[assert Testing: t<i64>().c == 3]]
16+
[[assert Testing: (v<i32>) == 1]]
17+
[[assert Testing: (v<void>) == 2]]
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 3723ede3cf5324827f8fbbe7f484c2ee4d7a7204)
2+
Target: x86_64-pc-linux-gnu
3+
Thread model: posix
4+
InstalledDir: /home/johel/root/clang-main/bin

regression-tests/test-results/clang-18/pure2-bugfix-for-non-local-function-expression.cpp.execution

Whitespace-only changes.

regression-tests/test-results/clang-18/pure2-bugfix-for-non-local-function-expression.cpp.output

Whitespace-only changes.

regression-tests/test-results/clang-18/pure2-print.cpp.output

Whitespace-only changes.

regression-tests/test-results/clang-18/pure2-template-specialization.cpp.execution

Whitespace-only changes.

regression-tests/test-results/clang-18/pure2-template-specialization.cpp.output

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sizeof(x) is 25
2+
(not a name)
3+
xyz

regression-tests/test-results/gcc-13/pure2-template-specialization.cpp.execution

Whitespace-only changes.

regression-tests/test-results/gcc-13/pure2-template-specialization.cpp.output

Whitespace-only changes.

0 commit comments

Comments
 (0)