ref storage class in templates

Extrawurst spam at extrawurst.org
Wed Apr 16 04:38:48 PDT 2008


the documentation states that ref is a storage class for function 
parameters. just that this code piece wont compile cause the compiler 
doesn't. const in contrast works in templates too. so if no one has a 
veto i will file this as a bug for dmd.

[CODE]
void call(U...)(void delegate(U) dg, U args)
{
    dg(args);
}

void main()
{
    void plus(ref int x)
    {}

    int val = 2;
    call!(ref int)(&plus,val);

}
[/CODE]

dmd2.012: main.d(13): expression expected, not 'ref'



More information about the Digitalmars-d mailing list