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


Rainer Schuetze <r.sagita...@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagita...@gmx.de


--- Comment #1 from Rainer Schuetze <r.sagita...@gmx.de> 2011-10-02 02:56:57 
PDT ---
A similar error happens if you try to compile time.di directly:

>dmd -c -o- c:\l\dmd-2.055\src\druntime\import\core\time.di

c:\l\dmd-2.055\src\druntime\import\core\time.di(253): Error: template
core.time.
TickDuration.to(string units,T) if ((units == "seconds" || units == "msecs" ||
u
nits == "usecs" || units == "hnsecs" || units == "nsecs") &&
(__traits(isIntegra
l,T) && T.sizeof >= 4)) does not match any function template declaration
c:\l\dmd-2.055\src\druntime\import\core\time.di(253): Error: template
core.time.
TickDuration.to(string units,T) if ((units == "seconds" || units == "msecs" ||
u
nits == "usecs" || units == "hnsecs" || units == "nsecs") &&
(__traits(isIntegra
l,T) && T.sizeof >= 4)) cannot deduce template function from argument types
!("s
econds",long)()

In time.di, the to template functions have been converted to eponymous
templates, which seems to trigger the error in combination with qualifiers.
Here is a reduced test case:

struct TickDuration
{
    template to(T) if (__traits(isIntegral,T))
    {
        const T to()
        {
            return 1;
        }
    }

    template to(T) if (__traits(isFloating,T))
    {
        const T to()
        {
            return 0;
        }
    }

    const long seconds() // line 21
    {
        return to!(long)();
    }

}

void main()
{
    TickDuration d;
    d.seconds();
}

>dmd test.d

test.d(21): Error: template test.TickDuration.to(T) if (__traits(isIntegral,T))
does not match any function template declaration
test.d(21): Error: template test.TickDuration.to(T) if (__traits(isIntegral,T))
cannot deduce template function from argument types !(long)()

The error disappears if you remove the const qualifier from seconds() or if you
remove the second template.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to