www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5697] New: Instantiation from typetuple of templates

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Mar 04 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5697


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



15:28:59 PST ---
*** This issue has been marked as a duplicate of issue 6474 ***

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