Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
March 12, 2010 [Issue 3935] New: opBinary is instantiated with "=" | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3935 Summary: opBinary is instantiated with "=" Product: D Version: 2.041 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: mrmocool@gmx.de --- Comment #0 from Trass3r <mrmocool@gmx.de> 2010-03-11 16:50:40 PST --- This is really strange behavior. It gets even stranger over time. It once started with Vector2f _pos = Vector2f(0.f, 0.f); yields: Error: template instance opBinary!("=") matches more than one template declaration Now I can't seem to reproduce it anymore. But in a bigger project, with the following code: Vector2 opBinary(string op, U:Vector2)(U v) { pragma(msg, "opBinary!"~op); } I get several instantiations with opBinary!= Even though http://www.digitalmars.com/d/2.0/operatoroverloading.html#Binary clearly states that "=" isn't overloadable which totally makes sense since there is http://www.digitalmars.com/d/2.0/operatoroverloading.html#Assignment -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 12, 2010 [Issue 3935] opBinary is instantiated with "=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=3935 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #1 from bearophile_hugs@eml.cc 2010-03-11 18:06:04 PST --- When you submit a bug it's better to show a minimal but complete program that shows your problem. This shows the situation (I think it's cute, an undocumented operator overload): struct Foo { void opBinary(string op)(Foo other) { pragma(msg, "op: " ~ op); } } void main() { Foo f; f = f; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 12, 2010 [Issue 3935] opBinary is instantiated with "=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=3935 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |spec, wrong-code --- Comment #2 from Trass3r <mrmocool@gmx.de> 2010-03-12 13:50:34 PST --- found the cause: if opAssign isn't present but opBinary is, opBinary is instantiated with "=". This could probably be fixed by replacing opover.c:458 with if (!s && !s_r && op != TOKequal && op != TOKnotequal && op != TOKassign) The question is if opAssign is really meant to stay. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 3935] opBinary is instantiated with "=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=3935 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #3 from Trass3r <mrmocool@gmx.de> 2010-07-28 06:41:55 PDT --- Sorry, just giving one line isn't good practice, so: =================================================================== --- opover.c (revision 589) +++ opover.c (working copy) @@ -474,7 +474,7 @@ Objects *targsi = NULL; #if DMDV2 - if (!s && !s_r && op != TOKequal && op != TOKnotequal) + if (!s && !s_r && op != TOKequal && op != TOKnotequal && op != TOKassign) { /* Try the new D2 scheme, opBinary and opBinaryRight */ if (ad1) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 27, 2010 [Issue 3935] opBinary is instantiated with "=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=3935 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-08-26 22:53:32 PDT --- http://www.dsource.org/projects/dmd/changeset/630 -- 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