What would you expect from the following:
enum Type { a, b, c };
public __gc class MClass
{
public:
MClass(Type t);
__property void set_Type(Type t);
// etc.
};
When compiling, I get very strange errors (in this case, for the constructor)
where the Type type is compiled as the managed Type property. It is an easy
fix, although the compiler diagnostic is far from intuitive.
Comments?
Tomas Restrepo \(MVP\) - 28 May 2004 00:42 GMT
Hi Julie,
> What would you expect from the following:
>
[quoted text clipped - 13 lines]
>
> Comments?
What errors are you getting? Compiling your sample code, I get:
t.cpp
t.cpp(9) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'
t.cpp(10) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'
which actually seems like a very good diagnostic message.

Signature
Tomas Restrepo
tomasr@mvps.org
Julie - 28 May 2004 01:22 GMT
"Tomas Restrepo (MVP)" wrote:
> Hi Julie,
>
[quoted text clipped - 28 lines]
>
> which actually seems like a very good diagnostic message.
My mistake --
Type should be MyType in all instances.
Tomas Restrepo \(MVP\) - 28 May 2004 02:14 GMT
Hi Julie,
> My mistake --
>
> Type should be MyType in all instances.
Meaning this, then?
#using <mscorlib.dll>
using namespace System;
enum MyType { a, b, c };
public __gc class MClass
{
public:
MClass(MyType t);
__property void set_Type(MyType t);
// etc.
};
Compiles fine for me :|

Signature
Tomas Restrepo
tomasr@mvps.org