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


--- Comment #0 from dawg dawgfoto.de 2012-07-26 18:27:22 PDT ---
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


--- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-26 19:35:40
PDT ---
This is a caused by bug# 8362 (that isSafe is totally broken), but the correct
fix would be to have bug# 8138 fixed so that the  safety of the functions
involved would be inferred. As it stands, attribute inferrence fails to solve
the problem if all of the isSafe stuff is removed.

I have a pull request which fixes bug# 8362, which should be updated later
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



--- Comment #2 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-26 20:19:14
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



--- Comment #3 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-26 21:23:42
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



--- Comment #4 from github-bugzilla puremagic.com 2012-07-27 17:33:39 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/3bd83aad16049fe037b1cded8e386fb9a509b313
Fix for regression bug# 8450.

This requires the fix for bug# 8362 in order to compile and work.

https://github.com/D-Programming-Language/phobos/commit/494cbc52957b501899b42932827db9c5ae5df65d
Merge pull request #725 from jmdavis/8450

Fix for regression bug# 8450.

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



--- Comment #5 from github-bugzilla puremagic.com 2012-07-27 17:44:00 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/59f3a6ae6b6761d568aeaa434d3208ea60bb02d2
Added fix for issue# 8450 to changelog.

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