473,322 Members | 1,620 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,322 software developers and data experts.

Managed C++ Compiler Bug ambiguous conversion with class Object

There seems to be a bug in managed VC++ when a class is named
'Object'. The code following demonstrates the problem. Note that if
the class named 'Object' is renamed ( and references to it changed
appropriately ) it compiles ok. It makes no difference if class
Object is fully qualified with the namespace, or if it's put in its
own namespace ( outside of AccountManager ) and fully qualified to
that one. Also, if the AccountManager class is changed in any way: (
remove the destructor, change the property to a method, remove the
IAcctMgrListener interface ), the code compiles. The compiler seems
to be confusing the user defined class Object with System.Object, all
be it an inconsistant confusion... the worst kind!

namespace AccountManager
{
public __gc class Object
{
};
public __gc __interface IAcctMgrListener
{
};
public __gc class IAcctMgrListenerJBridgeCallback :
public AccountManager::Object, public
AccountManager::IAcctMgrListener
{
public:
~IAcctMgrListenerJBridgeCallback(){ };
__property int get_jBridgeCallbackHandle(){return 0;};
};
}

Compiling generates the following error:

error C2594: 'argument' : ambiguous conversions from
'AccountManager::IAcctMgrListenerJBridgeCallback __gc *const ' to
'System::Object __gc *'
This diagnostic occurred in the compiler generated function
'AccountManager::IAcctMgrListenerJBridgeCallback:: ~IAcctMgrListenerJBridgeCallback'
Nov 17 '05 #1
1 1795
Dr Evil wrote:
There seems to be a bug in managed VC++ when a class is named
'Object'. The code following demonstrates the problem.


I was unable to repro this problem.

V:\>more t.cpp
#using <mscorlib.dll>

namespace AccountManager {
public __gc class Object {};
public __gc __interface IAcctMgrListener {};
public __gc class IAcctMgrListenerJBridgeCallback :
public AccountManager::Object,
public AccountManager::IAcctMgrListener {
public:
~IAcctMgrListenerJBridgeCallback() {};
__property int get_jBridgeCallbackHandle() {
return 0;
}
};
}

int main() {}

V:\>everett

ENVIRONMENT SET FOR EVERETT
Frameworks version v1.1.4322

V:\>cl /clr /Zs t.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 13.10.3077
for .NET Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

t.cpp

V:\>whidbey

ENVIRONMENT SET FOR WHIDBEY
Frameworks version v2.0.40120

V:\>cl /clr:oldSyntax /GS /Zs t.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40120
for Microsoft (R) .NET Framework version 2.00.40204.0
Copyright (C) Microsoft Corporation. All rights reserved.

t.cpp
There were no compiler errors matching yours. As you can see, I tried
Everett and a current internal build of Whidbey. If you still have the
repro, can you try it again?

--
Brandon Bray http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #2

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

Similar topics

19
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
2
by: Paul Kenny | last post by:
Hi, I am trying to expose the functionality of an unmanaged C++ class to the other languages available in the .NET Framework. I have decided to do this by wrapping the unmanaged C++ class in a...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
9
by: Herby | last post by:
Is possible to have a managed method within a Native(un-managed) class within a \clr project? E.g. class myClass { public: #pragma managed void myMethod(void);
18
by: John Rusk | last post by:
Hi, I have some weird compiler behaviour, so I'm hoping that one of the gurus here will be able to tell me whether or not it really is a compiler bug. In short, the compiler is saying that it...
4
by: moleskyca1 | last post by:
Hi, In a recent discussion, some of us were in disagreement about the functions the C++ compiler generates. How many functions are generated by the compiler when you declare: class Foo { };...
5
by: raylopez99 | last post by:
I need an example of a managed overloaded assignment operator for a reference class, so I can equate two classes A1 and A2, say called ARefClass, in this manner: A1=A2;. For some strange reason...
3
by: Markus Dehmann | last post by:
I think this is a question about automatic type conversion, but I didn't find the answer after googling for these words ... I have a class called Value (source see below) which can hold an int...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.