| 1 |
// REQUIRED_ARGS: -m32 |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/diag7420.d(21): Error: static variable `x` cannot be read at compile time |
| 6 |
fail_compilation/diag7420.d(21): while evaluating: `static assert(x < 4)` |
| 7 |
fail_compilation/diag7420.d(22): Error: static variable `y` cannot be read at compile time |
| 8 |
fail_compilation/diag7420.d(22): called from here: `__equals(y, "abc")` |
| 9 |
fail_compilation/diag7420.d(22): while evaluating: `static assert(y == "abc")` |
| 10 |
fail_compilation/diag7420.d(23): Error: static variable `y` cannot be read at compile time |
| 11 |
fail_compilation/diag7420.d(23): while evaluating: `static assert(cast(ubyte[])y != null)` |
| 12 |
fail_compilation/diag7420.d(24): Error: static variable `y` cannot be read at compile time |
| 13 |
fail_compilation/diag7420.d(24): while evaluating: `static assert(cast(int)y[0] == 1)` |
| 14 |
fail_compilation/diag7420.d(25): Error: static variable `y` cannot be read at compile time |
| 15 |
fail_compilation/diag7420.d(25): while evaluating: `static assert(y[0..1].length == 1u)` |
| 16 |
--- |
| 17 |
*/ |
| 18 |
|
| 19 |
int x = 2; |
| 20 |
char[] y = "abc".dup; |
| 21 |
static assert(x < 4); |
| 22 |
static assert(y == "abc"); |
| 23 |
static assert(cast(ubyte[])y != null); |
| 24 |
static assert(y[0] == 1); |
| 25 |
static assert(y[0..1].length == 1); |