A request for an easier way to pass a storage class to a template

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Oct 24 20:14:12 PDT 2011

And look, here they even get lost by ParameterTypeTuple:

import std.traits;

class Foo(Types...)
    alias void delegate(Types) DG;
    DG dg;

void test(ref int, ref int) { }

void main()
    auto foo = new Foo!(ParameterTypeTuple!test);
    foo.dg = (ref int, ref int) { };

Error: cannot implicitly convert expression (__dgliteral1) of type
void delegate(ref int _param_0, ref int _param_1) pure nothrow @safe
to void delegate((int, int))

This is completely bizarre since storage classes are actually kept in
that tuple if you try to print them out, e.g.:

pragma(msg, ParameterTypeTuple!test);
prints: (ref int, ref int)

More information about the Digitalmars-d mailing list