www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8450] New: measureTime doesn't work with unsafe template functions

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

           Summary: measureTime doesn't work with unsafe template
                    functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



cat > bug.d << CODE
import std.datetime, std.stdio;

void main()
{
    auto mt = measureTime!((a) {
        writefln("Running tests took: %s ms", a.msecs());
    })();
}
CODE

dmd bug

----

I only had a short look at this. I think the core issue is that
std.traits.isSafe doesn't work for template functions.
With v2.057 isSafe used to fail silently for template functions so the unsafe
measureTime overload was chosen and everything worked accidentally.
Since v2.058 isSafe will print an error but the  safe overload is selected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---


involved would be inferred. As it stands, attribute inferrence fails to solve
the problem if all of the isSafe stuff is removed.


today.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450




PDT ---
Hmmmm. I don't think that untyped lambda functions _can_ be considered  safe.
They need an actual type for that to be properly checkable. They're not
isCallable, and since they aren't fully formed, you can't actually know whether
or not it's  safe.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450




PDT ---
https://github.com/D-Programming-Language/phobos/pull/725

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/3bd83aad16049fe037b1cded8e386fb9a509b313




https://github.com/D-Programming-Language/phobos/commit/494cbc52957b501899b42932827db9c5ae5df65d




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450




Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/59f3a6ae6b6761d568aeaa434d3208ea60bb02d2


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8450


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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