www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7017] New: Pure inference makes inconsistent result

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

           Summary: Pure inference makes inconsistent result
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



Pure/nothrow/ safe inference with template function is shallow.
It does not affect to nested non-template struct member functions.

But in following code, map template function inferred as pure in some cases.
This is pure inference bug.

template map(fun...) if (fun.length >= 1)
{
    auto map()
    {
        struct Result {
            this(int dummy){}   // impure member function
        }
        return Result(0);   // impure call
    }
}
int foo(immutable int x) pure nothrow { return 1; }
void main() pure
{
    int bar(immutable int x) pure nothrow { return 1; }

    static assert(!__traits(compiles, map!((){})()));   // should pass, but
fails
    static assert(!__traits(compiles, map!q{ 1 }()));   // pass, OK
    static assert(!__traits(compiles, map!foo()));      // pass, OK
    static assert(!__traits(compiles, map!bar()));      // should pass, but
fails
}

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


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/536

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




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

https://github.com/D-Programming-Language/dmd/commit/cd2b0c924917ab75f3efeaf7eeaff3fa414844ed
fix Issue 7017 - Pure inference makes inconsistent result

https://github.com/D-Programming-Language/dmd/commit/e3daa5ed3e869d793e5c3a74be89842c248346f0


Issue 7017 - Pure inference makes inconsistent result

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


Walter Bright <bugzilla digitalmars.com> changed:

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


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