www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Struct constructor and opCall confussion

reply Tom <tom nospam.com> writes:
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;
Mar 07 2011
parent reply bearophile <bearophileHUGS lycos.com> writes:
Tom:

 Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think). I don't remember its number in bugzilla, sorry (anyone remembers it?). See also: http://d.puremagic.com/issues/show_bug.cgi?id=4053 Bye, bearophile
Mar 08 2011
parent reply Tom <tom nospam.com> writes:
El 08/03/2011 05:32, bearophile escribió:
 Tom:

 Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think). I don't remember its number in bugzilla, sorry (anyone remembers it?). See also: http://d.puremagic.com/issues/show_bug.cgi?id=4053 Bye, bearophile
Think I found it: http://d.puremagic.com/issues/show_bug.cgi?id=4253 This is indeed a major bug. Why not tag it as "major"? I think it's a straight loss of functionality and it happens under almost any circumstance in which one wishes to simply use opCall and a struct... Tom;
Mar 08 2011
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Tue, 08 Mar 2011 10:52:38 -0500, Tom <tom nospam.com> wrote:

 El 08/03/2011 05:32, bearophile escribió:
 Tom:

 Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think). I don't remember its number in bugzilla, sorry (anyone remembers it?). See also: http://d.puremagic.com/issues/show_bug.cgi?id=4053 Bye, bearophile
Think I found it: http://d.puremagic.com/issues/show_bug.cgi?id=4253
Those two bugs look almost identical, I think they should be combined... -Steve
Mar 08 2011
next sibling parent Tom <tom nospam.com> writes:
El 08/03/2011 13:05, Steven Schveighoffer escribió:
 On Tue, 08 Mar 2011 10:52:38 -0500, Tom <tom nospam.com> wrote:

 El 08/03/2011 05:32, bearophile escribió:
 Tom:

 Am I missing something or is this another major bug?
A major bug (that is not recognized as major, I think). I don't remember its number in bugzilla, sorry (anyone remembers it?). See also: http://d.puremagic.com/issues/show_bug.cgi?id=4053 Bye, bearophile
Think I found it: http://d.puremagic.com/issues/show_bug.cgi?id=4253
Those two bugs look almost identical, I think they should be combined... -Steve
I agree. They should be combined into a major (severity) bug.
Mar 08 2011
prev sibling parent bearophile <bearophileHUGS lycos.com> writes:
Steven Schveighoffe:

 Those two bugs look almost identical, I think they should be combined...
Right, they look similar. I have linked each with the other, so if one gets fixed it's very easy to see if the fix fixes the other too. One bug has 4 votes and one bug 1 vote. Bye, bearophile
Mar 08 2011