view test/bug73.d @ 129:8096ba7082db trunk

[svn r133] Fixed some problems with inlining not happening :P Fixed problems with certain cases of deeply nested classes/functions.
author lindquist
date Fri, 28 Dec 2007 22:55:24 +0100
parents 288fe1029e1f
children
line wrap: on
line source

int find(char[] s, dchar c)
{
    // c is a universal character
    foreach (int i, dchar c2; s)
    {
    if (c == c2)
        return i;
    }
    return -1;
}

void main()
{
    char[] hello = "hello world";
    int i = find(hello, 'w');
    assert(i == 6);
    i = find(hello, 'z');
    assert(i == -1);
}