Thread overview
[Issue 10047] New: getOverloads cannot resolve UFCS
May 08, 2013
SHOO
May 08, 2013
Kenji Hara
[Issue 10047] opDispatch instantiation failure should be gagged for UFCS
May 08, 2013
Kenji Hara
May 14, 2013
Walter Bright
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10047

           Summary: getOverloads cannot resolve UFCS
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: zan77137@nifty.com


--- Comment #0 from SHOO <zan77137@nifty.com> 2013-05-08 06:26:35 PDT ---
This code doesn't work:
----------
//import std.typecons;
struct Typedef(T){
    T a;
    template opDispatch(string name) {
        static if (__traits(getOverloads, a, name).length != 0) { }
    }
}
struct A {}
void foo(Typedef!A a) {}

void main()
{
    Typedef!A a;
    a.foo();
}
-----------

$ dmd -run main
main.d(5): Error: function main.foo (Typedef!(A) a) is not callable using
argume
nt types (A)
main.d(5): Error: a.foo cannot be resolved
main.d(14): Error: template instance
main.Typedef!(A).Typedef.opDispatch!("foo")
 error instantiating
main.d(14): Error: function expected before (), not a.(__error) of type _error_

-----------

git bisect result:

   5d7ccff11d5bc91824bda7b66edca6318742f80b is the first bad commit

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10047


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

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-08 06:58:07 PDT ---
Reduced test case.

struct Typedef(T)
{
    template opDispatch(string name)
    {
        static assert(0);
    }
}

struct A {}
void foo(Typedef!A a) { assert(0); }

void main()
{
    Typedef!A a;
    a.foo();
}

For the later UFCS name lookup, the errors in opDispatch instantiation should be gagged.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10047


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

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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-08 07:15:09 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1981

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10047



--- Comment #3 from github-bugzilla@puremagic.com 2013-05-13 17:46:13 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e61d989b600588269a91d0aaaff557890df7233d fix Issue 10047 - opDispatch instantiation failure should be gagged for UFCS

https://github.com/D-Programming-Language/dmd/commit/6daf3cc2a595e053d0bede7d0cc264cc2eb704ce Merge pull request #1981 from 9rnsr/fix10047

[REG2.063a] Issue 10047 - opDispatch instantiation failure should be gagged for UFCS

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10047


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