std.traits.ReturnType b0rking on function pointer.

Daniel Keep daniel.keep+lists at gmail.com
Wed Jan 17 11:34:25 PST 2007


Hey there, I'm having problems with getting the return type of a 
function pointer.  Basically, I want to do this:

template SDL_SafeCall(alias tFn)
{
     ReturnType!(SDL_SetVideoMode) SDL_SafeCall(...)
     {
         ...
     }
}
SDL_SafeCall!(SDL_SetVideoMode)(...);

where SDL_SetVideoMode is declared like so (yes, it's DerelictSDL):

typedef SDL_Surface* function(int,int,int,Uint32) pfSDL_SetVideoMode;
pfSDL_SetVideoMode          SDL_SetVideoMode;

When I try to compile my code, I get the following errors:

C:\Daniel\dmd\dmd\src\phobos\std\traits.d(34): alias 
std.traits.ReturnType!(pfSDL_SetVideoMode).ReturnType recursive alias 
declaration
C:\Daniel\dmd\dmd\src\phobos\std\traits.d(34): template instance 
std.traits.ReturnType!(pfSDL_SetVideoMode) error instantiating

I've tried writing my own version, but that didn't do any better. 
Anyone have any ideas?

	-- Daniel


More information about the Digitalmars-d-learn mailing list