summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/pure2-for-loop-range-with-lambda.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/pure2-for-loop-range-with-lambda.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/pure2-for-loop-range-with-lambda.cpp2')
-rw-r--r--CompilerDriver/cc2/regression-tests/pure2-for-loop-range-with-lambda.cpp230
1 files changed, 30 insertions, 0 deletions
diff --git a/CompilerDriver/cc2/regression-tests/pure2-for-loop-range-with-lambda.cpp2 b/CompilerDriver/cc2/regression-tests/pure2-for-loop-range-with-lambda.cpp2
new file mode 100644
index 0000000..066771b
--- /dev/null
+++ b/CompilerDriver/cc2/regression-tests/pure2-for-loop-range-with-lambda.cpp2
@@ -0,0 +1,30 @@
+first: (forward f, forward _...) -> forward _ = f;
+
+main: (args) = {
+ ints: const std::array = (1, 2, 3, 4, 5);
+ // OK
+ for ints.first() do (i) {
+ std::cout << i;
+ }
+
+ // OK
+ for ints.first(1) do (i) {
+ std::cout << i;
+ }
+
+ // Used to cause Error
+ for ints.first(:(x) x) do (i) {
+ std::cout << i;
+ }
+
+ // OK
+ temp := ints.first(:(x) x);
+ for temp do (i) {
+ std::cout << i;
+ }
+
+ for :() args$;() do (i) _ = i;
+ for :(x) x;(args) do (j) _ = j;
+ for :(x) x;(args) next _ = :() args$;() do (k) _ = k;
+ for :(x) x;(args) next _ = :(x) x;(args) do (l) _ = l;
+}