[Issue 4027] Closures in CTFE generate wrong code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 30 11:42:37 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4027
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |clugdbug at yahoo.com.au
Summary|Nested function's bug in |Closures in CTFE generate
|CTFE |wrong code
--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-03-30 11:42:35 PDT ---
The workaround does NOT work. It only looks as though it does. See this, for
example:
===
string delegate() bug4027(string s1) {
string s = s1;
return { return s; };
}
int food() {
auto a = bug4027("aaa");
auto b = bug4027("bbb");
assert(a() == "aaa"); // fails -- a() is "bbb" !!!
return 1;
}
static assert(food()==1);
----
The root cause is that closures are not yet supported in CTFE. They should
generate an error message at compile time.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list