September 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10945

           Summary: Type extracted in an 'is' expression in a constraint
                    should be visible in the template body
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-01 16:50:44 PDT ---
Here's some interesting code another user has provided, with a reduced test-case:

-----
struct Templ(Args...)
{
}

struct WillWork(alias T)
    if (is(T : Templ!Args, Args...))
{
    static if (is(T : Templ!Args, Args...))
        alias A = Args[0];
    else
        static assert(0);
}

struct WontWork(alias T)
    if (is(T : Templ!Args, Args...))
{
    // Error: undefined identifier Args, did you mean alias T?
    alias A = Args[0];
}

void main()
{
    alias C = Templ!int;
    alias B = WillWork!C;
    B.A a;

    alias B2 = WontWork!C;  // ng
}
-----

Note how the 'WillWork' template has to redundantly duplicate the constraint into a static if condition. It would be simpler if the body of the template had access to the types which were extracted with the 'is' expression in the template constraint.

I can't think of any harm this would do, it would be beneficial. If the template is extracting the types like that, it probably wants something to do with those types in the template body.

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


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-01 17:00:34 PDT ---
*** This issue has been marked as a duplicate of issue 6269 ***

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