dmd/compiler/test/fail_compilation/safe_pointer_index.d
Dennis 9b94878c85
Make safe error messages consistent (#20654)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-01-08 13:46:38 +08:00

12 lines
220 B
D

/*
TEST_OUTPUT:
---
fail_compilation/safe_pointer_index.d(11): Error: indexing pointer `x` is not allowed in a `@safe` function
---
*/
@safe void f(int* x)
{
int y = x[0]; // allowed, same as *x
int z = x[1];
}