gcc/testsuite/gdc.test/fail_compilation/test11176.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/test11176.d(12): Error: using `b.ptr` (instead of `&b[0])` is not allowed in a `@safe` function |
| 5 | fail_compilation/test11176.d(16): Error: using `b.ptr` (instead of `&b[0])` is not allowed in a `@safe` function |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | // https://issues.dlang.org/show_bug.cgi?id=11176 |
| 10 | |
| 11 | @safe ubyte oops(ubyte[] b) { |
| 12 | return *b.ptr; |
| 13 | } |
| 14 | |
| 15 | @safe ubyte oops(ubyte[0] b) { |
| 16 | return *b.ptr; |
| 17 | } |
| 18 | |
| 19 | @safe ubyte cool(ubyte[1] b) { |
| 20 | return *b.ptr; |
| 21 | } |