gcc/testsuite/gdc.dg/torture/gdc285.d
raw| 1 | // https://bugzilla.gdcproject.org/show_bug.cgi?id=285 |
| 2 | // { dg-do run } |
| 3 | // { dg-skip-if "needs gcc/config.d" { ! d_runtime } } |
| 4 | |
| 5 | inout(char)[] test285(inout(char)* s) @nogc @system pure nothrow |
| 6 | { |
| 7 | import core.stdc.string : strlen; |
| 8 | return s ? s[0 .. strlen(s)] : null; |
| 9 | } |
| 10 | |
| 11 | void main() |
| 12 | { |
| 13 | assert(test285(null) == null); |
| 14 | assert(test285("foo") == "foo"); |
| 15 | } |