summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2023-12-30 23:39:37 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2023-12-30 23:39:37 +0100
commit263915832993dd12beee10e204f9ebcc6c786ed2 (patch)
tree862e51208a99c35746e574a76564a4532b3a4a49 /CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2
Meta: initial commit of WestCo optimized toolchain.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2')
-rw-r--r--CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp240
1 files changed, 40 insertions, 0 deletions
diff --git a/CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2 b/CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2
new file mode 100644
index 0000000..1ebc595
--- /dev/null
+++ b/CompilerDriver/cc2/regression-tests/mixed-parameter-passing.cpp2
@@ -0,0 +1,40 @@
+
+#include <string>
+#include <cstdlib>
+#include <ctime>
+
+copy_from: (copy _) = { }
+
+parameter_styles: (
+ in _: std::string, // "in" is default
+ copy b: std::string,
+ inout _: std::string,
+ move d: std::string
+ )
+= {
+ z: int = 12;
+
+ z++;
+ b += "plugh";
+
+ if std::rand()%2 {
+ z++;
+ copy_from(b); // definite last use
+ }
+ else {
+ copy_from(b&); // NB: better not move from this (why not?)
+ copy_from(d);
+ copy_from(z++);
+ }
+
+ // std::move(z);
+
+ copy_from(z);
+
+ if std::time(nullptr)%2 == 0 {
+ copy_from(z);
+ }
+
+}
+
+main: () -> int = { }