[Issue 4913] New: Repeated template instantiations with the same symbol argument fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 21 18:41:44 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4913

           Summary: Repeated template instantiations with the same symbol
                    argument fails
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rsinfu at gmail.com


--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-09-21 18:41:06 PDT ---
The following valid code doesn't compile:
--------------------
template Test(alias symbol) {}

struct S(T...)
{
    T vars;                         // (5)
    alias Test!(vars[0]) first;
    alias Test!(vars[0]) second;    // (7)
}
alias S!(int) a;                    // (9)
--------------------
% dmd -o- -c test.d
test.d(5): Error: expression _vars_field_0 is not a valid template value
argument
test.d(7): Error: template instance test.Test!(_vars_field_0) error
instantiating
test.d(9):        instantiated from here: S!(int)
--------------------

The first instantiation of the Test with a symbol argument vars[0] succeeds. 
But the second instantiation fails.  The error does not occur if the line (7)
is commented out.

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