November 13, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2450

           Summary: Error using operators from named template mixin
           Product: D
           Version: 1.033
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: jminer2613@students.pcci.edu


template Event() {
        void opCall() { }
        void opAddAssign(int i) { }
}
class Button {
        mixin Event clicked;
        void func() {
                clicked.opCall(); // works
                this.clicked();   // works

                // Error: function expected before (), not mixin Event!()
clicked; of type void
                clicked();
                // Error: mixin 'Event!()' is not a variable
                clicked += 7;
        }
}

Tested with DMD v1.033.
A workaround is shown of using "this." before the name of the mixin, but that
could get annoying.


-- 

Top | Discussion index | About this forum | D home