Error on recursive alias

Johan Mollevik lijat.REMOVE.me at gmail.com
Sun Aug 25 07:17:02 PDT 2013


I have some code from a couple of years ago that I'm trying to update 
to modern D.

I was first using the gdc compiler in debian stable which seems based 
on DMD 2.055 but that caused somthing that looks like memmory 
coruption.

Using the newer gdc compiler in debian sid (based on DMD 2.062 i think) 
I run into this error instead.

util.d:23: Error: alias util.foreachType!(uint[4LU][4LU]).foreachType 
recursive alias declaration

This is for code that have worked previously looking like this

template foreachType(T)
{
        static if(is(opApplyType!(T) V))
        {    
                static if(is(opApplyType!(V[$-1])))
                        alias Tuple!(V[0..$-1],foreachType!(V[$-1])) 
foreachType;
                else 
                        alias V foreachType;
        }    
        else 
        {    
                pragma(msg,"Failed to resolve type ");
                static assert(0,opApplyType!(T));
        }    
}

I can post all the source code if anyone is interested

What my ultimate goal is is to resurect my opApplyN function allowing 
me to do things like this

uint[4][4] block;
foreach(x,y,v;opApplyN(block))
	printf("%d %d %d\n",x,y,v);


If anyone know a more convinient way to achive that that would be 
helpfull as well.


More information about the Digitalmars-d-learn mailing list