[Issue 12056] New: [CTFE] "couldn't find field" from delegate
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 1 10:44:35 PST 2014
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 at puremagic.com
ReportedBy: nilsbossung at googlemail.com
--- Comment #0 from Nils <nilsbossung at googlemail.com> 2014-02-01 10:44:32 PST ---
---
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: -------
More information about the Digitalmars-d-bugs
mailing list