[Issue 2157] New: mixin struct, function overload
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jun 20 22:32:11 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2157
Summary: mixin struct, function overload
Product: D
Version: 2.013
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: someanon at yahoo.com
$ dmd mixinstruct.d
mixinstruct.d(15): function mixinstruct.S.attr (int) does not match parameter
types ()
mixinstruct.d(15): Error: s.attr can only be called on a mutable object, not
const(S)
mixinstruct.d(15): Error: expected 1 arguments, not 0
mixinstruct.d(15): Error: expression s.attr() is void and has no value
$ cat mixinstruct.d
==============================================================
template T() {
int m_attr;
const {int attr() {return m_attr;}} // reader
}
struct S {
mixin T;
void attr(int n) {m_attr = n;} // writer
}
int main() {
const S s;
int r;
r = s.attr(); // why this resolve to the writer? but not the reader?
return r;
}
==============================================================
--
More information about the Digitalmars-d-bugs
mailing list