www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2450] New: Error using operators from named template mixin


           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
                // 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.

Nov 12 2008