Thread overview
[Issue 7873] New: [2.059 beta] IFTI with inout does not properly match template parameter if called from inout function for pointers
Apr 10, 2012
Kenji Hara
Apr 10, 2012
Walter Bright
April 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7873

           Summary: [2.059 beta] IFTI with inout does not properly match
                    template parameter if called from inout function for
                    pointers
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-04-09 08:58:18 PDT ---
This worked in 2.058:

inout(T) * foo(T)(inout(T)* t)
{
    static assert(is(T == int *));
    return t;
}

inout(T)* bar(T)(inout(T)* t)
{
    return foo(t);
}

void main()
{
    int *i;
    bar(&i);
}

It fails the assert in the 2.059 beta.

It seems to only happen if 'i' is a pointer, and only if foo is called with an inout variable from an inout function.

Note that the function still compiles ( with typeof(t) == inout(int *)* ), it's
just that the T is not properly extracted using IFTI.  This has consequences if
you use T to create another template.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7873


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-09 19:40:02 PDT ---
This issue was introduced by merging dmd/pull#800. https://github.com/D-Programming-Language/dmd/pull/800

A pull to fix this issue. https://github.com/D-Programming-Language/dmd/pull/872

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7873



--- Comment #2 from github-bugzilla@puremagic.com 2012-04-09 21:01:05 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7c22b8af8041a97c74e87a6e941ef14bb49905b6 Merge pull request #872 from 9rnsr/fix7873

Issue 7873 - IFTI with inout does not properly match template parameter if called from inout function for pointers

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7873


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