[Issue 14916] New: opDispatch: no property error for parameter type mismatch
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 13 06:04:19 PDT 2015
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: nobody at puremagic.com
Reporter: luis at luismarques.eu
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'"
}
--
More information about the Digitalmars-d-bugs
mailing list