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

           Summary: Instantiation from typetuple of templates
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-03-04 09:50:53 PST ---
This D2 code compiles and runs with no errors (DMD 2.052):


template TypeTuple(TList...) {
    alias TList TypeTuple;
}
int foo(alias bar)() {
    return bar();
}
int spam() {
    return 1;
}
void main() {
    alias TypeTuple!(foo, foo) templates;
    alias templates[0] templates0; // OK
    assert(templates0!spam() == 1); // OK
}




But if I remove the alias, to merge the last two lines:

template TypeTuple(TList...) {
    alias TList TypeTuple;
}
int foo(alias bar)() {
    return bar();
}
int spam() {
    return 1;
}
void main() {
    alias TypeTuple!(foo, foo) templates;
    assert(templates[0]!spam() == 1); // line 12, error
}



It doesn't compile, with the errors:

test.d(12): found '!' when expecting ')'
test.d(12): found 'spam' when expecting ';' following statement
test.d(12): expression expected, not ')'


Some alternative ways to write this line don't seem to work:
templates[0]!spam()

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

Reply via email to