[Issue 3119] Segfault(expression.c) template function overloads with function with same name in other module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 9 07:36:37 PDT 2009


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


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

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


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2009-10-09 07:36:36 PDT ---
ANALYSIS:
expression.c, line 6693:

    if (!f)
    {   /* No overload matches, just set f and rely on error
         * message being generated later.
         */
        f = (FuncDeclaration *)eo->vars->a.data[0];
    }

This is wrong because it's not necessarily a FuncDeclaration, it could be a
TemplateDeclaration instead. I think an error message needs to be generated
immediately.

Change this to something like:

    if (!f)
    {   /* No overload matches, just set f and rely on error
         * message being generated later.
         */
        error("no overload matches %s", savedFuncName);
        return this;
    }

after having added to line 6320 something like:

    istemp = 0;
Lagain:
+    char *savedFuncName = toChars();
    //printf("Lagain: %s\n", toChars());
    f = NULL;
    if (e1->op == TOKthis || e1->op == TOKsuper)
    {
    // semantic() run later for these
    }
    else
    {
    UnaExp::semantic(sc);

since the UnaExp::semantic() call turns the name into __overloadset which makes
yucky error messages.

-- 
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