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


Andrei Alexandrescu <and...@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |and...@metalanguage.com


--- Comment #4 from Andrei Alexandrescu <and...@metalanguage.com> 2012-01-16 
09:25:15 PST ---
(In reply to comment #3)
> Everything behaves as specified in TDPL. This is not a compiler bug.

Yah, I just tested this:

import std.stdio, std.traits;
void main()
{
    auto fn = { writeln("function"); };
    static assert(isFunctionPointer!(typeof(fn)));
    int x;
    auto dg = { writeln("delegate because it prints ", x); };
    static assert(isDelegate!(typeof(dg)));
}

So the literal is properly classified as a function or delegate depending on it
needing a frame pointer or not.

There's one remaining question I have. I rewrote the example like this:


import std.stdio, std.traits;

void main()
{
    auto fn = { writeln("function"); };
    static assert(is(typeof(fn) == function));

    int x;
    auto dg = { writeln("delegate because it prints ", x); };
    static assert(is(typeof(dg) == delegate));
}

The second static assert works, but the first doesn't. Why?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to