www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10526] New: opDispatch with IFTI should not disable UFCS

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

           Summary: opDispatch with IFTI should not disable UFCS
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-07-02 19:27:17 PDT ---
From: http://forum.dlang.org/post/cxgefmgjnzgoizrdtcbb forum.dlang.org

In following code, opDispatch call requires IFTI due to TemplateTupleParameter
T deduction. However it unexpectedly disables UFCS.

import std.conv, std.stdio, std.algorithm;

struct S
{
    void opDispatch(string s, T...)(T t)
    if (s.startsWith("foo")) 
    {
        writeln(s);
    }
}

void main()
{
    S s;

    s.foo();
    // --> OK

    auto p = s.to!string();
    // --> Error: s.opDispatch!("to") isn't a template
}

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-02 20:42:47 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2292

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



--- Comment #2 from github-bugzilla puremagic.com 2013-07-05 11:20:31 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/10ce85d0d9c661843ad8bd77c23f229bf5732ca1
fix Issue 10526 - opDispatch with IFTI should not disable UFCS

When opDispatch result is a function template that requires IFTI, it would be
kept on `DotTemplateInstanceExp` so `ti->needsTypeInference(sc)` returns TRUE
in its semantic().

UFCS dispatch should check that the opDispatch result is really valid or not,
by instantiating the function template.

https://github.com/D-Programming-Language/dmd/commit/11d22d63ac22eb5980b6370f5f93a2a22e995e29
Merge pull request #2292 from 9rnsr/fix_ufcs

Issue 10526 - opDispatch with IFTI should not disable UFCS

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


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: -------
Jul 05 2013