dmd/compiler/test/fail_compilation/staticforeach4.d
2022-07-09 18:53:07 +02:00

17 lines
544 B
D

/*
REQUIRED_ARGS: -verrors=context
TEST_OUTPUT:
---
fail_compilation/staticforeach4.d(16): Error: index type `byte` cannot cover index range 0..257
static foreach (byte a, int b; data) { }
^
fail_compilation/staticforeach4.d(17): Error: index type `byte` cannot cover index range 0..257
static foreach (byte a, int b; fn()) { }
^
---
*/
immutable int[257] data = 1;
int[257] fn() { return data; }
static foreach (byte a, int b; data) { }
static foreach (byte a, int b; fn()) { }