digitalmars.D.bugs - [Issue 4053] New: To avoid struct ctor/opCall conflicts
- d-bugmail puremagic.com (40/40) Apr 02 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4053
- d-bugmail puremagic.com (11/11) Jan 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4053
- d-bugmail puremagic.com (15/15) Mar 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4053
- d-bugmail puremagic.com (6/6) Mar 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4053
- d-bugmail puremagic.com (10/10) Apr 28 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4053
- d-bugmail puremagic.com (12/12) Jun 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4053
http://d.puremagic.com/issues/show_bug.cgi?id=4053 Summary: To avoid struct ctor/opCall conflicts Product: D Version: future Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is a D2 program: struct Foo { this(int x=0) {} static void opCall(int x, int y) {} } void main() { auto f2 = Foo(1); // line 6, OK auto f3 = Foo(1, 2); // line 7, Err, opCall not found auto f1 = Foo(); // line 8, Err, conflicts with opCall again } dmd 2.042 gives: test.d(7): Error: constructor test.Foo.this (int x = 0) is not callable using argument types (int,int) test.d(7): Error: expected 1 arguments, not 2 for non-variadic function type ref Foo(int x = 0) test.d(8): Error: function test.Foo.opCall (int x, int y) is not callable using argument types () test.d(8): Error: expected 2 function arguments, not 0 test.d(8): Error: variable test.main.f1 voids have no value test.d(8): Error: expression opCall() is void and has no value My suggestion is in structs to disallow opCall() if a this() is present. This makes the program more tidy, and avoids that conflict with opCall when Foo() is used with no arguments. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 02 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4053 Adam D. Ruppe <destructionator gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |destructionator gmail.com 05:18:58 PST --- An important addition to the suggestion: *static* opCall is the real problem here. There should be no problem between an instance opCall and a constructor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4053 This (modified) example from Tom shows problems with not static opCall too: struct Foo { int i; this(int i) { this.i = i; } void opCall(int x, int y) {} } void main() { Foo foo; foo(1, 2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4053 See also bug 4253 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4053 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm gmail.com Probably the same as issue 1840. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 28 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4053 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |k.hara.pg gmail.com Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 6036 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 21 2011