Bug: __gc pointer in delegate declaration causes error message

B

Bart Jacobs

Dear VC++ team,

I am fairly certain I found a bug in VC++ 7.1.

I get the following error

========================================================================

Microsoft (R) C/C++ Standard Compiler Version 13.10.3077 for .NET Framework
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

test.cpp
test.cpp(3) : error C2653: 'xSystem' : is not a class or namespace name
test.cpp(3) : error C2143: syntax error : missing ',' before '*'

========================================================================

when I compile the following code:

==== Begin test.cpp ====================================================

#using <mscorlib.dll>

public __delegate void Test(int __gc * x, int * y);

int main() { return 0; }

==== End test.cpp ======================================================

using the following command line:

cl /clr test.cpp

which indicates some kind of buffer overflow or something, since the
name "xSystem" does not occur anywhere in the code.

Greetings

Bart Jacobs
 
B

Bart Jacobs

In my bug report, I forgot to mention a workaround, which was discovered
by Eugene Mayevski <[email protected]>. Thanks, Eugene!

The workaround is simply to use references instead of pointers. For
example, the following works perfectly:

public __delegate void Test(int __gc & x, int * y);
 

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