[Issue 7210] opCall weird behavior in struct

2012-10-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7210


Kenji Hara  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||DUPLICATE


--- Comment #4 from Kenji Hara  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: ---


[Issue 7210] opCall weird behavior in struct

2012-10-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7210


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #3 from bearophile_h...@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: ---


[Issue 7210] opCall weird behavior in struct

2012-09-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7210


Andrej Mitrovic  changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com


--- Comment #2 from Andrej Mitrovic  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: ---


[Issue 7210] opCall weird behavior in struct

2012-05-08 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7210


Gašper Ažman  changed:

   What|Removed |Added

   Keywords||rejects-valid
 CC||gasper.az...@gmail.com


--- Comment #1 from Gašper Ažman  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: ---