Thursday, April 24, 2008

C2860 and C++/CLI

Just for future Googlers, it is possible to get a compile error from the C++/CLI compiler (that is, Visual Studio 2005 compiling C++ code with the /clr switch) which looks like

C2860: 'void' cannot be an argument type, except for '(void)'

This happens at absolutely random places where you reference .NET objects that it should already know about. (The error will further read, if you look at the detailed compiler output, something like " This diagnostic occurred while importing type 'Fred::Ethel ' from assembly 'cppclitestingfs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.")

Muh? It turns out in this case the class I was using used a class in its definition a class which came from another assembly (FSharp.Core, as it turns out, but it could have been anyone.) Instead of saying something useful like 'Fred::Ethel references type Option<A> which is not defined', it said ''void' cannot be an argument type'. Obviously.

My completely un-called for guess? Someone on the C++/CLI compiler team substituted the word 'void', perhaps by accident, when an imported type had an unresolved external reference. Another compiler pass downstream complained quite rightly about this, but lacked context to give a more meaningful message. Is there a place one submits bugs in Microsoft compilers that is not informationally equivalent to a black hole?

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home