[Issue 995] compile-time function return element of Tuple / const array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 22 09:39:58 PST 2007


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





------- Comment #1 from Daniel919 at web.de  2007-02-22 11:39 -------
Is this related to the bug ?
--------------------------------------------------------------------
import std.stdio;

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

char[] retsth(int i) {
        const char[] foo[2] = ["a","b"];
        return foo[i];
}
//Error: cannot evaluate retsth(0) at compile time
//Error: expression eval!(retsth(0)) is void and has no value

void main()
{
        writefln(eval!(retsth(0)));
}
--------------------------------------------------------------------

PS: Ultimately I would like to be able to do:
writefln(eval!(std.string.stripl("   test"));
Maybe some more string operations could be compile-time ready ?
I am not sure whether this will work if this bug get's fixed,
so maybe this is a feature req ;)


-- 



More information about the Digitalmars-d-bugs mailing list