x.RC.__postblit () is not callable using argument types () const
Ali Çehreli
acehreli at yahoo.com
Mon Feb 4 17:38:54 PST 2013
On 02/04/2013 05:15 PM, Dan wrote:
> I've seen these type of errors often and usually the cause kind of jumps
> out. In this case I'm totally confused. Just trying to move from 2.06 to
> 2.061.
>
> The code is: http://dpaste.dzfl.pl/f40e4d6f
> and fails with the error in subject line. Observations:
>
> - If "static if(1)" is changed to "static if(0)" it compiles
> - If either _valuationHistory or goo member of BSItem is commented out
> it compiles.
>
> I know the code is somewhat cryptic, but I've been using binary
> reduction comment in/out to try to narrow down this issue. I can not
> understand why an introduction of opEquals on a struct History with no
> relationship to RC causes an error to show for RC.
>
> Thanks
> Dan
Further reduced:
struct History(V) {
bool opEquals(const typeof(this) other) const {
return true;
}
}
struct RC {
this(this) { _impl = _impl.dup; }
string[] _impl;
}
struct BSItem {
ValuationHistory _valuationHistory;
RC[int] goo;
}
struct ValuationHistory {
History!double _history;
}
void main() {
}
The problem is related to History.opEquals being 'const'. Remove that
'const' and the code compiles. This must be a (lack of)
const-correctness issue.
Ali
More information about the Digitalmars-d-learn
mailing list