mardi 31 mars 2015

Casting an object with events defined to an interface type causes an internal compiler error

I've got an interface with a simple signature:



namespace Serial {

public interface struct ISerial
{
uint16_t func1();
uint16_t func2();
};
}


and then a class type which implements the interface



namespace Serial {
public delegate void MyEventClass();

public ref class MySerial sealed : public ISerial {
public:
event MyEventClass MyEvent;

MySerial();

...
};
}


but elsewhere, as a default parameter to a function, I try to store a reference to a type MySerial as an ISerial ^



void
begin(
Serial::ISerial ^s = ref new Serial::MySerial
);


causes: error C1001: An internal error has occurred in the compiler.


when I remove the event from the class definition, everything compiles fine. I'm finding little information on this error.


Aucun commentaire:

Enregistrer un commentaire