Managed C++ Compiler Bug ambiguous conversion with class Object

D

Dr Evil

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'
 
B

Brandon Bray [MSFT]

Dr said:
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:blush:ldSyntax /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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top