digitalmars.D.bugs - [Issue 7210] New: opCall weird behavior in struct
- d-bugmail puremagic.com (54/54) Jan 03 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7210
- d-bugmail puremagic.com (58/58) May 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7210
- d-bugmail puremagic.com (10/10) Sep 17 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7210
- d-bugmail puremagic.com (10/10) Oct 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7210
- d-bugmail puremagic.com (11/11) Oct 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7210
http://d.puremagic.com/issues/show_bug.cgi?id=7210 Summary: opCall weird behavior in struct Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: szadows gmail.com --- Comment #0 from Robik <szadows gmail.com> 2012-01-03 10:29:52 PST --- I've been working on my project and expected weird behavior when using opCall with structs. I've made a simple test case to demonstrate it. Following code compiles on DMD 2.057: import std.stdio; import std.stdio; void main() { auto test = Test(""); auto nested = Test("1"); nested.tests ~= Test("2"); test.tests ~= nested; writeln(test.get("1")); writeln(test.opCall("1")); writeln(test("1")); } struct Test { Test[] tests; string str; public this(string str) { this.str = str; } public ref Test get(string str) { return tests[0]; } alias get opCall; } Current result: Test([Test([], "2")], "1") Test([Test([], "2")], "1") Test([], "1") Expected result: Test([Test([], "2")], "1") Test([Test([], "2")], "1") Test([Test([], "2")], "1") As you may see, `test.opCall` works correct, when `test()` is not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7210 Gašper Ažman <gasper.azman gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |gasper.azman gmail.com --- Comment #1 from Gašper Ažman <gasper.azman gmail.com> 2012-05-08 10:37:12 PDT --- This is more about opCall not working for structs whenever a constructor is present. For instance, this works: import std.stdio; struct B { int number; string word; static B opCall(int n) { B b = {n, ""}; return b; } string opCall(string w) { word = w; return word; } } void main() { auto b = B(3); writeln(b("Hello World")); } but this doesn't: import std.stdio; struct A { int number; string word; this(int n) { number = n; word = ""; } string opCall(string w) { word = w; return word; } } int main() { auto a = A(3); writeln(a("Hello World")); } atom kamichan $ dmd test.d test.d(20): Error: constructor test.A.this (int n) is not callable using argument types (string) test.d(20): Error: cannot implicitly convert expression ("Hello World") of type string to int test.d(18): Error: function D main has no return statement, but is expected to return a value of type int atom kamichan $ dmd DMD64 D Compiler v2.059 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7210 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com --- Comment #2 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-09-17 10:49:44 PDT --- *** Issue 8677 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: -------
Sep 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7210 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #3 from bearophile_hugs eml.cc 2012-10-06 11:03:06 PDT --- Seems fixed. See Issue 6036 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7210 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2012-10-06 16:44:29 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: -------
Oct 06 2012