tdpl: function literals versus delegate lierals
Jerome BENOIT
g6299304p at rezozer.net
Thu Jan 19 08:41:35 PST 2012
Hello List:
On my box, the following D source, inspired by the subsection 5.6.1 of tDpl,
does not work as expected:
-----------------------------------------------------------------
// adhoc_06.d
import std.stdio;
unittest {
// Tersest, most convenient code
auto f = (int i) {};
writeln(typeid(f));
assert(is(f == function));
}
void main() {}
-----------------------------------------------------------------
I get:
void delegate()
core.exception.AssertError at adhoc_06.d(7): unittest failure
According to the book, the assertion is true and f is a function
but not a literal.
What is going wrong ?
Thanks in advance,
Jerome
More information about the Digitalmars-d-learn
mailing list