www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6488] New: DMD compiler bug

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6488

           Summary: DMD compiler bug
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: soarowl yeah.net



When I compile tools\rdmd.d with following options:

dmd -inline -J. -noboundscheck -nofloat -O -release rdmd.d

Compiler has this error:

Error: template core.time.TickDuration.to(string units,T) if ((units ==
"seconds" || units == "msecs" || units == "usecs" || units == "hnsecs" || units
== "nsecs") && (__traits(isIntegral,T) && T.sizeof >= 4)) cannot deduce
template function from argument types !("seconds",long)()

But if I compile rdmd.d with those options, all fine:

dmd -inline -J. -nofloat -O -release rdmd.d
dmd -J. -noboundscheck -nofloat -O -release rdmd.d
dmd -inline -J. -noboundscheck -nofloat -O rdmd.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6488


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de



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: -------
Oct 02 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6488


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



10:16:58 PDT ---
https://github.com/D-Programming-Language/dmd/commit/c5947dc3c6ddd23b18732ec4ad4c84f1e4c9c06e

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 18 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6488




10:18:19 PDT ---
*** Issue 6502 has been marked as a duplicate of this issue. ***

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