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


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|tupleof(member) is          |typeof(object) is
                   |incorrectly evaluated inside|incorrectly evaluated
                   |foreach over members-tuple  |




------- Comment #3 from [EMAIL PROTECTED]  2008-11-14 19:42 -------
I believe this is relevant:

import std.stdio;

void foo(T)(T t)
{
    assert(is(typeof(t) == T));
    writeln(T.stringof);
    writefln(typeof(t).stringof);
}

struct A
{
    int i;

    void test()
    {
        foreach (m; this.tupleof) {
            foo(m); // line 17
        }
    }
}

void main()
{
    foo(new A());
}

Expected output:
A*
A*

Actual output:
A*
int

Looks like result of typeof(t) is evaluated just once at compile time and then
reused at every template instantiation. Commenting line 17 hides the issue.


-- 

Reply via email to