[Issue 5738] error message for template mismatch could be better

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 15 05:29:52 PDT 2011


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


Trass3r <mrmocool at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal


--- Comment #1 from Trass3r <mrmocool at gmx.de> 2011-03-15 05:26:43 PDT ---
another more cryptic example is the following:

void bla() {}

class Blub
{
    U getInfo(U, alias infoFunction = bla)(uint infoname)
    {
        return 0;
    }

    uint referenceCount() const
    {
        return getInfo!uint(55u);
    }
}

refconst.d(12): Error: template refconst.Blub.getInfo(U,alias infoFunction =
bla) does not match any function template declaration
refconst.d(12): Error: template refconst.Blub.getInfo(U,alias infoFunction =
bla) cannot deduce template function from argument types !(uint)(uint)

The problem is that getInfo needs to be const as well, but there's no hint
whatsoever. It's hard to detect that in a big codebase.


Removing alias infoFunction from getInfo results in a slightly less cryptic
(but still non-intuitiv message, but that's another issue:
http://d.puremagic.com/issues/show_bug.cgi?id=4497):

refconst.d(10): Error: function refconst.Blub.getInfo!(uint).getInfo (uint
infoname) is not callable using argument types (uint) const

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