[Issue 6221] New: Should be possible to pass struct function returns by 'const ref'.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 29 01:36:49 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6221
Summary: Should be possible to pass struct function returns by
'const ref'.
Product: D
Version: D2
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at yahoo.com.au> 2011-06-29 01:31:54 PDT ---
struct S6221 {
int num;
}
S6221 blah6221()
{
return S6221(1);
}
void boo6221(const ref S6221 rhs) {}
void bug6221()
{
boo6221(blah6221()); // fails; not callable with argument types S6221
}
This is a particular problem because of opCmp:
struct S
{
int num;
int opCmp(const ref S rhs) const
{
if (num < rhs.num)
return -1;
else if (num > rhs.num)
return 1;
return 0;
}
}
S blah() {
return S(1);
}
void bug()
{
bool b1 = blah() < S(45); // OK
bool b2 = S(45) > blah(); // fails
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list