Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
November 13, 2006 [Issue 500] New: Cannot assign to delegate during definition | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=500 Summary: Cannot assign to delegate during definition Product: D Version: 0.173 Platform: PC OS/Version: Windows Status: NEW Severity: minor Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: marsell_pk@yahoo.com This compiles: void delegate() y; y = { ... }; This does not: void delegate() y = { ... }; For example: void main() { // void delegate() y = { return; }; void delegate() y; y = { return; }; x(y); } void x(void delegate() y) { y(); } -- |
November 14, 2006 [Issue 500] Cannot assign to delegate during definition | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=500 ------- Comment #1 from brunodomedeiros+bugz@gmail.com 2006-11-14 07:55 ------- Not sure it's a bug, that error is because of syntax conflict with struct initializers (http://www.digitalmars.com/d/struct.html). It's a limitation that might or might not be fixable, I dunno. (It does seem possible for the grammar to differentiate Meanwhile, a workaround: void delegate() y = ({ return; }); -- |
November 14, 2006 [Issue 500] Struct Initializers conflict with Delegate Literals in initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=500 ------- Comment #2 from smjg@iname.com 2006-11-14 13:03 ------- (In reply to comment #1) > Not sure it's a bug, that error is because of syntax conflict with struct initializers (http://www.digitalmars.com/d/struct.html). It's a limitation that might or might not be fixable, I dunno. (It does seem possible for the grammar to differentiate The only cases parseable as either a struct init or a function/delegate body are { } { { } } { { { } } } and so on. Otherwise, it's obvious whether a { ... } contains expressions or statements. -- |
December 03, 2006 [Issue 500] Struct Initializers conflict with Delegate Literals in initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=500 deewiant@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #3 from deewiant@gmail.com 2006-12-03 03:53 ------- Fixed in DMD 0.176. -- |
December 23, 2006 Re: [Issue 500] New: Cannot assign to delegate during definition | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-11-13: > http://d.puremagic.com/issues/show_bug.cgi?id=500 > This compiles: > void delegate() y; > y = { ... }; > > This does not: > void delegate() y = { ... }; > > For example: > void main() { > // void delegate() y = { return; }; > void delegate() y; > y = { return; }; > x(y); > } > > void x(void delegate() y) { > y(); > } Added to DStress as http://dstress.kuehne.cn/run/d/delegate_20_A.d http://dstress.kuehne.cn/run/d/delegate_20_B.d Thomas |
Copyright © 1999-2021 by the D Language Foundation