www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10095] New: Regression (git-head): Cannot resolve type for template instance

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

           Summary: Regression (git-head): Cannot resolve type for
                    template instance
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-05-16
07:12:52 PDT ---
-----
import std.conv;

string foo(alias var, T = typeof(var))()
{
    foreach (idx, member; __traits(allMembers, T))
    {
        to!string(var.tupleof[idx]);  // without this the error is gone
    }

    return "";
}

string foo(T)(T var)  // without this the error is gone
{
    return "";
}

struct S
{
    int i;
    string s;
}

void main()
{
    S s = S(1, "");
    auto x = foo!s;
}
-----

2.062
$ dmd test.d
 
2.063: $ dmd test.d
 test.d(29): Error: cannot resolve type for foo!(s)
 test.d(29): Error: cannot infer type from template instance foo!(s)
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 16 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10095


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-05-16 09:21:38 PDT ---
*** This issue has been marked as a duplicate of issue 10096 ***

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