473,659 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a bug invoking base class's property?

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_Tex t(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_Tex t(string)
Parent::set_Tex t(msg);
}
};

int main()
{
Child* c = new Child();
c->Test(); // this is fine
c->Text = S"Huihong";
return 0;
}
Nov 17 '05 #1
3 1330
Huihong,

What version / build of the compiler are you using? Your code compiles and runs correctly for me on whidbey 31216.00

--
Jackson Davis [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
--------------------

Nov 17 '05 #2
Hi Jackson,

Thanks for the help. I was using v1.1.4322, will try
whidbey PDC 2003 release. If Whidbey works, then the bug
has been fixed.

Huihong
-----Original Message-----
Huihong,

What version / build of the compiler are you using? Your code compiles and runs correctly for me on whidbey 31216.00
--
Jackson Davis [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are
subject to the terms specified athttp://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the
newsgroup/thread from which they originated.--------------------

.

Nov 17 '05 #3
I tried Whidbey PDC2003 release, it didn't work, see
below. Running the compiled exe causes stack overflow. The
compiler issued a warning, which is why I wonder whether
this is a desired behavior.

Perhaps, the bug was fixed after pdc release.

C:\experimental >cl /clr SuperCallTest.c pp
Microsoft (R) C/C++ Optimizing Compiler Version
14.00.30703.27
for Microsoft (R) .NET Framework version 1.02.30703.27
Copyright (C) Microsoft Corporation. All rights reserved.

SuperCallTest.c pp
c:\experimental \supercalltest. cpp(34) : warning
C4717: 'Child::set_Tex t' : recur
sive on all control paths, function will cause runtime
stack overflow
Microsoft (R) Incremental Linker Version 8.00.30703.27
Copyright (C) Microsoft Corporation. All rights reserved.

/out:SuperCallTe st.exe
SuperCallTest.o bj

-----Original Message-----
Huihong,

What version / build of the compiler are you using? Your code compiles and runs correctly for me on whidbey 31216.00
--
Jackson Davis [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are
subject to the terms specified athttp://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the
newsgroup/thread from which they originated.--------------------

.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7332
by: mrstephengross | last post by:
Ok, I've got code that looks something like this: ================================================== template<typename T1, typename T2> class Base { public: explicit Base(const T1 & t1) { /* ... */ } };
4
2707
by: Alfonso Morra | last post by:
Hi, I have a variable that stores a pointer to a base class. I am using this variable to store pointers to objects of the base class, as well as pointers to other derived classes. However, the derived classes have methods (not available on the base class) that I would like to invoke. I thought I could simply cast the pointer to the appropriate derived class and access the methods this way - but that dosen't work.
6
6657
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
7
6613
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
0
1551
by: michael | last post by:
Hi. I have a problem using the CollectioEditor. In my custom control I have a public property that returns ItemList. ItemList is inherited from CollectionBase and contains very simple items called "TestItem" that are inherited from Control. i have added,To the TestItem class, a proprety called "ItemIcon", and I added to this property the attribute Editor(typeof(ImageUrlEditor)....). In design-time, I can access the "ItemList" property...
4
2844
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. '**************************************************************************** ' Issues '****************************************************************************
12
3429
by: Hemanth | last post by:
Hi, I have a base class with a static constructor and some abstract methods. Derived classes implement these methods. From articles on the web, it appears that there is no guarentee that this static constructor of the base class would be invoked even if a an object of the derived class is created. Is this correct ? Is there any way to ensure the base class's static constructor is invoked before the derived class instance is constructed ?...
3
2237
by: hurcan solter | last post by:
Consider the code fragment; class A { public: A(){} A(int prm):mprm(prm){} int mprm; }; class B:public A {
26
5354
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is because I am not always able to control/create all the different constructors the base class has. My problem can be described in code as follows ... /* This is the base class with a whole heap of constructors/functionality*/ public class Animal
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.