possible bug with function pointers and aliases

BCS BCS_member at pathlink.com
Mon May 15 23:29:31 PDT 2006


In article <sbwzwiubkkgj.wwgyourrqvs4.dlg at 40tude.net>, Derek Parnell says...
>
>On Mon, 15 May 2006 15:22:59 -0700, BCS wrote:
>
>> 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
>> }
>> -------------
>> 
>
>I think it should be a compile error. However the error that is shown is
>really weird!
>
>  test.d(13): function test.fn called with argument types:
>          ()
>  matches both:
>          test.fn()
>  and:
>          test.gm()
>

Thanks for the sanity check, I didn't think I was missing anything but it's
always nice to get a second opinion.

as to the error message I think that what is happening is that the "things" that
the string "fn" can be referring to are printed. Line numbers would be really
helpful





More information about the Digitalmars-d-bugs mailing list