H
Huihong
I found when invoking the same property of a base class,
the MC++ compiler seems to emit incorrect IL code, and
causes causes stack overflow:
class Child : public Parent {
__property void set_Text(String *s)
{
Parent::Text = s;
}
};
It emits:
call instance void Child::set_Text(string)
is it supposed to be?
call instance void Parent::set_Text(string)
Is this a bug, or desired behavior?
Thanks,
Huihong
Remotesoft
======= test code ========
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
__gc class Parent
{
public:
virtual void Test(void)
{
}
__property void set_Text(String* msg)
{
}
};
__gc class Child : public Parent
{
public:
virtual void Test(void)
{
Parent::Test();
}
__property void set_Text(String* msg)
{
// this causes stack overflow, IL: call
instance void Child::set_Text(string)
Parent::Text = msg;
// this is fine, IL: call instance void
Parent::set_Text(string)
Parent::set_Text(msg);
}
};
int main()
{
Child* c = new Child();
c->Test(); // this is fine
c->Text = S"Huihong";
return 0;
}
the MC++ compiler seems to emit incorrect IL code, and
causes causes stack overflow:
class Child : public Parent {
__property void set_Text(String *s)
{
Parent::Text = s;
}
};
It emits:
call instance void Child::set_Text(string)
is it supposed to be?
call instance void Parent::set_Text(string)
Is this a bug, or desired behavior?
Thanks,
Huihong
Remotesoft
======= test code ========
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
__gc class Parent
{
public:
virtual void Test(void)
{
}
__property void set_Text(String* msg)
{
}
};
__gc class Child : public Parent
{
public:
virtual void Test(void)
{
Parent::Test();
}
__property void set_Text(String* msg)
{
// this causes stack overflow, IL: call
instance void Child::set_Text(string)
Parent::Text = msg;
// this is fine, IL: call instance void
Parent::set_Text(string)
Parent::set_Text(msg);
}
};
int main()
{
Child* c = new Child();
c->Test(); // this is fine
c->Text = S"Huihong";
return 0;
}