www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - overload

reply Ant <duitoolkit yahoo.ca> writes:
I don't think this is new, but anyway...


class Bug
{

	void foo()
	{
	}

	static void foo(int i)
	{
	}

	static void bar()
	{
		foo(1);
	}
}

int main(char[][] args)
{
}


dmd O.d -I~/dmd/src/phobos
O.d(14): 'this' is only allowed in non-static member functions

Jun 08 2004
parent Ant <duitoolkit yahoo.ca> writes:
On Tue, 08 Jun 2004 19:21:56 -0400, Ant wrote:

 I don't think this is new, but anyway...
 

 class Bug
 {
 
 	void foo()
 	{
 	}
 
 	static void foo(int i)
 	{
 	}
 
 	static void bar()
 	{
 		foo(1);
 	}
 }
 
 int main(char[][] args)
 {
 }
 

 dmd O.d -I~/dmd/src/phobos
 O.d(14): 'this' is only allowed in non-static member functions

still a problem in 0.94 however if we change the order we define the functions to have the static foo first compiles and runs class Bug { static void foo(int i) { printf("static void foo\n"); } void foo() { printf("void foo\n"); } static void bar() { printf("static void bar\n"); foo(1); } } int main(char[][] args) { Bug b = new Bug; b.foo(); b.bar(); return 0; }
Jul 01 2004