Struct constructor and opCall confussion

Tom tom at nospam.com
Mon Mar 7 11:24:52 PST 2011


D2 Code:

int main(string[] args) {

	struct S {
		int i;
		this(int i) { this.i = i; }
		void opCall(int x, int y) { }
	}
	
	S s;
	s(4, 1);
	
	return 0;
}

src\main.d(12): Error: constructor main.main.S.this (int i) is not 
callable using argument types (int,int)
src\main.d(12): Error: expected 1 arguments, not 2 for non-variadic 
function type ref S(int i)


Am I missing something or is this another major bug?

T.I.A.,
Tom;


More information about the Digitalmars-d-learn mailing list