gcc/testsuite/gdc.dg/gdc43.d
raw| 1 | // https://bugzilla.gdcproject.org/show_bug.cgi?id=43 |
| 2 | // { dg-do compile } |
| 3 | |
| 4 | void main() |
| 5 | { |
| 6 | import core.vararg; |
| 7 | import core.stdc.stdio; |
| 8 | |
| 9 | void formatArray(ref va_list argptr) |
| 10 | { |
| 11 | auto a = va_arg!(const(float)[])(argptr); |
| 12 | foreach(f; a) |
| 13 | { |
| 14 | printf("%f\n", f); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | void doFormat(TypeInfo[] arguments, va_list argptr) |
| 19 | { |
| 20 | formatArray(argptr); |
| 21 | } |
| 22 | |
| 23 | void format(...) |
| 24 | { |
| 25 | doFormat(_arguments, _argptr); |
| 26 | } |
| 27 | |
| 28 | format([1.0f, 2.0f, 3.0f]); |
| 29 | } |