Bug 11950 – Weird bracket behavior in delegates

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-19T06:39:00Z
Last change time
2015-06-09T05:14:39Z
Assigned to
nobody
Creator
czdanol

Comments

Comment #0 by czdanol — 2014-01-19T06:39:09Z
import std.stdio; import std.conv; //version = right; struct A { int val = 3; }; void main() { void delegate( A ) Ptr; Ptr = ( a ) { version( right ) writefln( a.val.to!string ); else writefln( ( a.val ).to!string ); }; A i; Ptr( i ); } Code with writefln( ( a.val ).to!string ); causes an error (Error: need 'this' for 'val' of type 'int'), the second one doesn't.
Comment #1 by k.hara.pg — 2015-03-25T05:08:31Z
Fixed in 2.066. *** This issue has been marked as a duplicate of issue 12688 ***