digitalmars.D.bugs - [Issue 12056] New: [CTFE] "couldn't find field" from delegate
- d-bugmail puremagic.com (57/57) Feb 01 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12056
https://d.puremagic.com/issues/show_bug.cgi?id=12056 Summary: [CTFE] "couldn't find field" from delegate Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: CTFE, rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: nilsbossung googlemail.com --- --- cat > test.d << code struct A { void call(void delegate() dg) {dg();} } struct B { int f; void m() { A a; a.call({auto err = f;}); } } bool go() { B b; b.m(); return true; } static assert(go()); code dmd -c test.d --- test.d(12): Error: couldn't find field f of type int in A() test.d(3): called from here: dg() test.d(12): called from here: a.call(delegate () { int err = this.f; } ) test.d(19): called from here: b.m() test.d(23): called from here: go() test.d(23): while evaluating: static assert(go()) --- The error message says "couldn't find field [...] in A()", when the field should be looked up in B. The error remains the same even when a field f is added to A. This also affects opApply. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 01 2014