diff options
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.cpp2 | 30 |
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; +} |
