[Issue 974] New: compile-time parenthesis bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 17 03:14:57 PST 2007


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

           Summary: compile-time parenthesis bug
           Product: D
           Version: 1.006
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: Daniel919 at web.de


import std.stdio;

template eval(A...) { alias A eval; }

char[] trimfirst(char[] s)
{
    int x = 0;
    foreach (char each; s) {
        if (each != ' ')
        //{
            return s[x .. $];
        //}
        //Without the parenthesis, the compile-time version doesn't work !

        x++;
    }
    return s;
}

void main()
{
    writefln(eval!(trimfirst("  test"))); //Output: "  test"
    writefln(trimfirst("  test"));        //Output: "test"
}


-- 



More information about the Digitalmars-d-bugs mailing list