view tangotests/vararg4.d @ 217:0806379a5eca trunk

[svn r233] Added: -oq command line option for writing fully qualified object names. Added: started support for x86 80bit floating point. Changed: aggregates passed by value now use the llvm 'byval' parameter attribute, also lays ground work for using other attributes. Changed: eliminated a lot more std::vectorS, these showed up pretty much at the top when profiling! Changed: performed other misc. cleanups. Changed: halt expression now call the new llvm trap intrinsic instead of an assert(0). Changed: dstress suite now passes -O0 by default, this only eliminates unreferenced globals, which speeds up linking quite a bit.
author lindquist
date Thu, 05 Jun 2008 06:38:36 +0200
parents
children
line wrap: on
line source

module tangotests.vararg4;

extern(C) int printf(char*, ...);

struct S
{
    int i;
}

void func(...)
{
    S* sp = cast(S*)_argptr;
    assert(sp.i == 42);
}

void main()
{
    printf("1st:\n");
    {
    S s = S(42);
    func(s);
    }
    printf("ok\n");

    printf("2nd:\n");
    {
    func(S(42));
    }
    printf("ok\n");
}