473,320 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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_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;
}
Nov 17 '05 #1
3 1314
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.cpp
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.cpp
c:\experimental\supercalltest.cpp(34) : warning
C4717: 'Child::set_Text' : 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:SuperCallTest.exe
SuperCallTest.obj

-----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
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
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,...
6
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
7
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
0
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...
4
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. ...
12
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...
3
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
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.