Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 19, 2011 [Issue 6036] New: Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6036 Summary: Constructor, static opCall and object opCall Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid, rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-19 00:57:14 PDT --- Created an attachment (id=980) Test cases for this issue. ---- struct S{ ... } S(...) // (a) S s; s(...) // (b) ---- We should lookup them following order: (a) From type 1. Constructor call Constructors are defined with arguments (>= 1), and hide any signature of static opCalls. 2. Static opCall If no constructors exists, static opCalls are checked. 3. When matching with 1 and 2 failed, struct literal syntax is checked. 4. Otherwise makes error. (b) From object 1. Matchings are tested against static opCalls and object (=non-static) opCalls. 2. No opCalls makes error. These rules reject following current dmd bugs: - Constructors are visible from object. This problem pointed out by issue 1840, issue 4053 and issue 4253. - Object opCalls are visible from type. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 19, 2011 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2011-05-19 04:30:50 PDT --- This is an important issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 19, 2011 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch See Also| |http://d.puremagic.com/issu | |es/show_bug.cgi?id=4053 --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-19 06:23:13 PDT --- Posted patch as pull request: https://github.com/D-Programming-Language/dmd/pull/72 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 21, 2011 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-21 07:03:25 PDT --- *** Issue 4253 has been marked as a duplicate of this issue. *** --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-21 07:03:40 PDT --- *** Issue 4053 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 26, 2011 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 wfunction@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wfunction@hotmail.com --- Comment #5 from wfunction@hotmail.com 2011-09-26 10:38:11 PDT --- An instance-level opCall should not disable the regular constructor. Test case: struct Adder { int v; auto opCall(int x) { return x + v; } } auto adder(int v) { return Adder(v); // How do I call the constructor?? } int main() { auto a = adder(5); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 23, 2012 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |steve.teale@britseyeview.co | |m --- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-23 04:59:33 PST --- *** Issue 2916 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 28, 2012 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 --- Comment #7 from bearophile_hugs@eml.cc 2012-05-27 18:14:48 PDT --- See also Issue 4678 and Issue 7210 and Issue 1840 This is a problem I hit often. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 31, 2012 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 --- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-30 19:39:35 PDT --- *** Issue 4678 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 14, 2012 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 jens.k.mueller@gmx.de changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jens.k.mueller@gmx.de --- Comment #9 from jens.k.mueller@gmx.de 2012-08-14 07:41:29 PDT --- This bug makes using opCall practically useless. As soon as you have a constructor you get a compile error when you want to call opCall using the bracket syntax. E.g. the following code does not compile. struct F { this(int a) { } int opCall(int x, int y) { return 1; } } unittest { F f; int i; i = f(3,4,5); // Error: constructor F.this (int a) is not callable using argument // types (int,int,int) // workaround: i = f.opCall(3,4,5); } This is v2.060 on Linux. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 06, 2012 [Issue 6036] Constructor, static opCall and object opCall | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=6036 --- Comment #10 from github-bugzilla@puremagic.com 2012-10-06 06:57:56 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c8aba4a80895a7fcab9b1e023fa336d4012b6c05 fix Issue 6036 - Constructor, static opCall and object opCall https://github.com/D-Programming-Language/dmd/commit/098096c3b38f1cd0e8feb41caebbbb2f0f59b8fe Merge pull request #72 from 9rnsr/fix_opCall Issue 6036 - Constructor, static opCall and object opCall -- 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