www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10047] New: getOverloads cannot resolve UFCS

reply d-bugmail puremagic.com writes:
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



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
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10047


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

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



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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10047


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

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



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 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10047




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


[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 13 2013
prev sibling parent d-bugmail puremagic.com writes:
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: -------
May 13 2013