windows - Casting an object with events defined to an interface type causes an internal compiler error -
i've got interface simple signature:
namespace serial { public interface struct iserial { uint16_t func1(); uint16_t func2(); }; }
and class type implements interface
namespace serial { public delegate void myeventclass(); public ref class myserial sealed : public iserial { public: event myeventclass myevent; myserial(); ... }; }
but elsewhere, default parameter function, try store reference type myserial iserial ^
void begin( serial::iserial ^s = ref new serial::myserial );
causes: error c1001: internal error has occurred in compiler.
when remove event class definition, compiles fine. i'm finding little information on error.
i verified on vs 2013 , works few minor changes (all generated based on normal compiler errors, not ice). don't have vs 2015 available right now, log bug if still repros.
first struct (should unchanged)
namespace serial { public interface struct iserial { uint16_t func1(); uint16_t func2(); }; }
then class (couple of changes noted below):
namespace serial { public delegate void myeventclass(); public ref class myserial sealed : public iserial{ public: event myeventclass^ myevent; myserial(){} virtual uint16_t func1() { return 42; } virtual uint16_t func2() { return 42; } }; }
and usage:
void foo() { using namespace serial; iserial^ foo = ref new myserial(); }
basically need add hat (^
) event type, , need add virtual
methods (but not add override
).
Comments
Post a Comment