https://issues.dlang.org/show_bug.cgi?id=14916
Issue ID: 14916
Summary: opDispatch: no property error for parameter type
mismatch
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
unittest // getter is fine
{
struct S
{
auto opDispatch(string name)()
{
return 42;
}
}
S s;
s.foo;
}
unittest // setter is fine
{
struct S
{
void opDispatch(string name)(ushort value)
{
}
}
S s;
s.foo = 42; // fine
long x = 42;
s.foo = x; // correct error: "not callable using argument types (long)"
}
unittest // getter and setter... bug: misleading error
{
struct S
{
auto opDispatch(string name)()
{
return 42;
}
void opDispatch(string name)(ushort value)
{
}
}
S s;
s.foo = 42; // fine
long x = 42;
s.foo = x; // *wrong* error: "no property 'foo' for type 'S'"
}
--