Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
April 03, 2010 [Issue 4053] New: To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from bearophile_hugs@eml.cc 2010-04-02 17:03:42 PDT --- 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: ------- |
January 06, 2011 [Issue 4053] To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4053 Adam D. Ruppe <destructionator@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |destructionator@gmail.com --- Comment #1 from Adam D. Ruppe <destructionator@gmail.com> 2011-01-06 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: ------- |
March 08, 2011 [Issue 4053] To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4053 --- Comment #2 from bearophile_hugs@eml.cc 2011-03-08 00:32:29 PST --- 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: ------- |
March 08, 2011 [Issue 4053] To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4053 --- Comment #3 from bearophile_hugs@eml.cc 2011-03-08 09:53:38 PST --- See also bug 4253 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 28, 2011 [Issue 4053] To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4053 kennytm@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm@gmail.com --- Comment #4 from kennytm@gmail.com 2011-04-28 11:41:16 PDT --- Probably the same as issue 1840. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 21, 2011 [Issue 4053] To avoid struct ctor/opCall conflicts | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | 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 --- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-21 07:03:40 PDT --- *** 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: ------- |
Copyright © 1999-2021 by the D Language Foundation