[Issue 14418] New: D-style Variadic Function example does not compile
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Apr 6 05:28:41 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14418
Issue ID: 14418
Summary: D-style Variadic Function example does not compile
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: websites
Assignee: nobody at puremagic.com
Reporter: secondaryAccount at web.de
The example for a 'D-style Variadic Function' on http://dlang.org/function.html
does not compile.
import core.vararg;
void test()
{
foo(3, 4, 5); // first variadic argument is 5
}
int foo(int x, int y, ...)
{
int z;
z = va_arg!int(_argptr); // z is set to 5
}
dmd 2.067.0 output [ dmd -main filename.d ]:
Error: function [modulename].foo has no return statement, but is expected to
return a value of type int
same with gdc (frontend 2.065) and ldc (2.066.1).
Possible fixes:
- make foo void
- add 'return z;'
--
More information about the Digitalmars-d-bugs
mailing list