Files
ldc/test/calls1.d
Tomas Lindquist Olsen bc08c6fcb1 [svn r135] * Merged DMD 1.025 *
* Fixed a minor linking order mishap *
* Added an command line option -annotate *
* Fixed some problems with running optimizations *
* Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) *
* Fixed problems with passing aggregate types to variadic functions *
* Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory *
* Fixed problems with resolving nested function context pointers for some heavily nested cases *
* Redid function argument passing + other minor code cleanups, still lots to do on this end... *
2008-01-04 01:38:42 +01:00

66 lines
963 B
D

module calls1;
import std.stdarg;
void main()
{
{int a = byVal1(3);}
{int a = void; byRef1(a);}
{char[] c = void; refType(c);}
{char[] c = void; refTypeByRef(c);}
{S s = void; structByVal(s);}
{S s = void; structByRef(s);}
{S s = void; structByPtr(&s);}
{printf("c-varargs %d %d %d\n", 1,2,3);}
{int i=3; float f=24.7; dvararg(i,f);}
{char[] s = "hello"; dvarargRefTy(s);}
{char[] ss = "hello world!"; dvarargRefTy(ss);}
}
int byVal1(int a)
{
return a;
}
void byRef1(ref int a)
{
a = 3;
}
void refType(char[] s)
{
}
void refTypeByRef(ref char[] s)
{
}
struct S
{
float f;
double d;
long l;
byte b;
}
void structByVal(S s)
{
}
void structByRef(ref S s)
{
}
void structByPtr(S* s)
{
}
void dvararg(...)
{
printf("%d %.1f\n", va_arg!(int)(_argptr), va_arg!(float)(_argptr));
}
void dvarargRefTy(...)
{
char[] s = va_arg!(char[])(_argptr);
printf("%.*s\n", s.length, s.ptr);
}