Thread overview
[Issue 2010] New: Template tuples don't work in string mixins
Apr 18, 2008
d-bugmail
Apr 18, 2008
d-bugmail
Sep 23, 2009
Don
April 18, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2010

           Summary: Template tuples don't work in string mixins
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: bartosz@relisoft.com


A variable-argument function works at runtime, but doesn't compile as a mixin:

mixin (declareAllFeatures ("a", "b", "c"));

string declareAllFeatures (T...)(T features)
{
        string [] arr = [];
        foreach (f; features)
        {
                arr ~= f;
        }
        return declareAllFeaturesArr (arr);
}

string declareAllFeaturesArr (string [] allFeatures)
{
        return "int x;";
}


-- 

April 18, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2010





------- Comment #1 from bartosz@relisoft.com  2008-04-18 18:08 -------
The order of declarations seems to matter, so here's the modified example and the error message:

string declareAllFeaturesArr (string [] allFeatures)
{
    return "int x;";
}

string declareAllFeatures (T...)(T features)
{
    string [] arr = [];
    foreach (f; features)
    {
            arr ~= f;
    }
    return declareAllFeaturesArr (arr);
}

mixin (declareAllFeatures ("a", "b", "c"));

Error: cannot evaluate declareAllFeatures(&"a",&"b",&"c") at compile time


-- 

September 23, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2010


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |FIXED


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-23 05:25:00 PDT ---
This was fixed before 2.022.

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