Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3581 "private" attribute breaks "override"
It's slightly more general than in the bug report: any non-virtual function cannot use override.
- Loading branch information
9f7b2f8There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing this causes the following failure compiling phobos:
std\typecons.d(1581): Error: constructor std.typecons.AutoImplement!(C,generateEmptyFunction,isAbstractFunction).AutoImplement.this cannot override a non-virtual function
The code in question is:
class AutoImplement(Base, alias how, alias what = isAbstractFunction) : Base
{
private alias AutoImplement_Helper!(
"autoImplement_helper_", "Base", Base, how, what )
autoImplement_helper_;
override mixin(autoImplement_helper_.code);
}
Until what to do about this is figured out, I can't merge this in.
9f7b2f8There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I happen to have the patch installed, I stumbled over this problem today when running the unittests. The problem is that the "override" sets the attribute for the complete mixin, including auto-implemented constructors.
Here's a patch that moves the override attribute to each generated function if it is not a constructor:
Left file: C:\Dokumente und Einstellungen\Rainer\Lokale Einstellungen\Temp\typ2F.d
Right file: M:\s\d\rainers\phobos\std\typecons.d