summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules/xmake_tests4/src
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-28 20:31:13 +0800
committerruki <[email protected]>2025-12-29 00:09:39 +0800
commitbdfa86bccebb1bed6f3c7cec97db58d69ec44572 (patch)
tree870f7980ac7db09a695125af5457aa9e706873a0 /tests/projects/c++/modules/xmake_tests4/src
parentefbe455bd1bbbd320174d36af99e95fb1628dfa5 (diff)
fix xmake test for std modules
Diffstat (limited to 'tests/projects/c++/modules/xmake_tests4/src')
-rw-r--r--tests/projects/c++/modules/xmake_tests4/src/main.cpp5
-rw-r--r--tests/projects/c++/modules/xmake_tests4/src/work.mpp14
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/xmake_tests4/src/main.cpp b/tests/projects/c++/modules/xmake_tests4/src/main.cpp
new file mode 100644
index 000000000..45222c241
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests4/src/main.cpp
@@ -0,0 +1,5 @@
+import work;
+
+int main() {
+ do_work<int>();
+}
diff --git a/tests/projects/c++/modules/xmake_tests4/src/work.mpp b/tests/projects/c++/modules/xmake_tests4/src/work.mpp
new file mode 100644
index 000000000..27b5f2089
--- /dev/null
+++ b/tests/projects/c++/modules/xmake_tests4/src/work.mpp
@@ -0,0 +1,14 @@
+export module work;
+import std;
+
+export
+template<typename T>
+void do_work() {
+ if constexpr (std::is_same_v<T, int>) {
+ std::println("Hello world!");
+ } else if constexpr (std::is_same_v<T, double>) {
+ std::println("Hello test!");
+ } else {
+ std::println("Hello unknown type!");
+ }
+}