www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 974] New: compile-time parenthesis bug

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: Daniel919 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"
}


-- 
Feb 17 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=974


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed DMD 1.007


-- 
Feb 26 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=974






Added to DStress as
http://dstress.kuehne.cn/run/i/interpret_01_A.d
http://dstress.kuehne.cn/run/i/interpret_01_B.d


-- 
Mar 11 2007