Thread overview | |||||
---|---|---|---|---|---|
|
March 18, 2010 [Issue 3983] New: Regression(2.037): struct with == can't be member of struct with template opEquals | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3983 Summary: Regression(2.037): struct with == can't be member of struct with template opEquals Product: D Version: 2.034 Platform: Other OS/Version: Windows Status: NEW Keywords: diagnostic, rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: clugdbug@yahoo.com.au --- Comment #0 from Don <clugdbug@yahoo.com.au> 2010-03-18 02:48:16 PDT --- struct Fug { bool opEquals(ref const Fug y) const { return false; } } struct Fig { // line 29 Fug f; bool opEquals(Tdummy=void)(ref const Fig y) const { return false; } bool opEquals(T: int)(T y) const { return false; } } void main() { Fig fx, fy; if (fx==2) {} } --- And the error message is nonsense: bug.d(29): Error: function bug.Fig.opEquals conflicts with template bug.Fig.opEq uals(Tdummy = void) at bug.d(31) Worked in 2.036. -------- // Workaround is to change Fug opEquals to: bool opEquals(Tdummy=void)(ref const Fug y) const -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 11, 2010 [Issue 3983] Regression(2.037): struct with == can't be member of struct with template opEquals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3983 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-06-11 02:36:12 PDT --- Problem is in struct.c, StructDeclaration::semantic(), line 497: it tries to find an opEquals() function, and if not present, it builds one. It should look for a template opEquals() also. If there's a template opEquals, then creating a non-template opEquals will inevitably cause a naming conflict. Dsymbol *s = search_function(this, Id::eq); FuncDeclaration *fdx = s ? s->isFuncDeclaration() : NULL; + TemplateDeclaration *td = s ? s->isTemplateDeclaration() : NULL; if (fdx) { eq = fdx->overloadExactMatch(tfeqptr); if (!eq) fdx->error("type signature should be %s not %s", tfeqptr->toChars(), fdx->type->toChars()); } - if (!eq) + if (!eq && !td) eq = buildOpEquals(sc2); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 28, 2010 [Issue 3983] Regression(2.037): struct with == can't be member of struct with template opEquals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don | http://d.puremagic.com/issues/show_bug.cgi?id=3983 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-06-27 23:15:27 PDT --- http://www.dsource.org/projects/dmd/changeset/564 -- 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