[Issue 3983] Regression(2.037): struct with == can't be member of struct with template opEquals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 11 02:36:18 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3983


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list