-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
117 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
t: @struct <T: type> type = { | ||
a: i32 = 1; | ||
} | ||
t: @struct <T: type> specialize<T> type requires std::is_void_v<T> = { | ||
b: i32 = 2; | ||
} | ||
t: @struct specialize<i64> type = { | ||
c: i32 = 3; | ||
} | ||
v: <T> const i32 = 1; | ||
v: <> specialize<void> const i32 = 2; | ||
main: () = { | ||
[[assert Testing: t<i32>().a == 1]] | ||
[[assert Testing: t<void>().b == 2]] | ||
[[assert Testing: t<i64>().c == 3]] | ||
[[assert Testing: (v<i32>) == 1]] | ||
[[assert Testing: (v<void>) == 2]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
clang version 18.0.0 (https://git.uplinklabs.net/mirrors/llvm-project.git c0abd3814564a568dfc607c216e6407eaa314f46) | ||
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 3723ede3cf5324827f8fbbe7f484c2ee4d7a7204) | ||
Target: x86_64-pc-linux-gnu | ||
Thread model: posix | ||
InstalledDir: /home/johel/root/clang-main/bin |
Empty file.
Empty file.
Empty file.
Empty file.
41 changes: 41 additions & 0 deletions
41
regression-tests/test-results/pure2-template-specialization.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
#define CPP2_USE_MODULES Yes | ||
|
||
//=== Cpp2 type declarations ==================================================== | ||
|
||
|
||
#include "cpp2util.h" | ||
|
||
template<typename T> class t; | ||
|
||
|
||
//=== Cpp2 type definitions and function declarations =========================== | ||
|
||
template<typename T> class t { | ||
public: cpp2::i32 a {1}; | ||
}; | ||
template<typename T> requires( std::is_void_v<T> ) | ||
class t<T> {public: cpp2::i32 b {2}; | ||
}; | ||
template<> class t<cpp2::i64> { | ||
public: cpp2::i32 c {3}; | ||
}; | ||
template<typename T> extern cpp2::i32 const v; | ||
|
||
auto main() -> int; | ||
|
||
|
||
//=== Cpp2 function definitions ================================================= | ||
|
||
|
||
#line 10 "pure2-template-specialization.cpp2" | ||
template<typename T> cpp2::i32 const v {1}; | ||
template<> cpp2::i32 const v<void> {2}; | ||
auto main() -> int{ | ||
cpp2::Testing.expects(t<cpp2::i32>().a == 1, ""); | ||
cpp2::Testing.expects(t<void>().b == 2, ""); | ||
cpp2::Testing.expects(t<cpp2::i64>().c == 3, ""); | ||
cpp2::Testing.expects((v<cpp2::i32>) == 1, ""); | ||
cpp2::Testing.expects((v<void>) == 2, ""); | ||
} | ||
|
2 changes: 2 additions & 0 deletions
2
regression-tests/test-results/pure2-template-specialization.cpp2.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pure2-template-specialization.cpp2... ok (all Cpp2, passes safety checks) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters