possible bug with function pointers and aliases
    BCS 
    BCS at pathlink.com
       
    Mon May 15 15:22:59 PDT 2006
    
    
  
Is this proper operation?
-------------
void fn(){assert(0);}	// make a function
void gm(){assert(0);}	// make another function
alias gm fn;		// alias the second with the name of the first
void main()
{			// make pointer-to-function from name
	void function() fnp = & fn;
			// call pointer-to-function
	fnp();
	// fn();	// wont compile with this line included
}
-------------
This compiles and calls the first function. However if the function "fn" 
is called directly, a compile time error is generated.
This seems to be another manifestation of DMD's failure to check for 
multiple choices when filling a pointer type.
(see: http://d.puremagic.com/bugzilla/show_bug.cgi?id=52)
    
    
More information about the Digitalmars-d-bugs
mailing list