Is this supposed to be a bug?
Jarrett Billingsley
jarrett.billingsley at gmail.com
Sun Nov 2 17:21:18 PST 2008
On Sun, Nov 2, 2008 at 7:56 PM, Daniel Ribeiro Maciel
<daniel.maciel at gmail.com> wrote:
> void handler( alias dg )()
> {
> alias ParameterTypeTuple!( typeof(dg) ) TParamTuple;
> alias ReturnType!(dg) TResult;
>
> TParamTuple params;
> foreach( ref param; params )
> {}
> }
>
> double hello( double i )
> {
> writefln( "zomfg ", i );
> }
>
> int main( in string[] )
> {
> handler!(hello)();
> }
>
> This code yields error on "foreach( ref param; params )": Error : No storage class for value param
>
> Best regards,
> Daniel
>
>
For some reason you can't use 'ref' on tuple foreaches. You'll just
have to use the index-value version:
foreach(i, param; params) { /* set params[i] here */ }
More information about the Digitalmars-d
mailing list