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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 16 07:12:53 PDT 2013


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 at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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: -------


More information about the Digitalmars-d-bugs mailing list