Miscellaneous Container Templates

compilation failure on Visual C++ 2008

Reported by Paul Pogonyshev on 2012-11-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

great work -- I am currently using on linux (g++), solaris (sparc & x86), aix and hpux with there native c++ compilers respectively. Last platform I need is 64 bit window with visual studio. The incomplete templates in the intruviness portion of the code is confusing the compiler. I am a basic c++ user, and complex templates require a great deal of study for me to untangle. I thought you might have a quick workaround. the error I am getting is:

c:/users/scottk/work/dev/esp/current/develop/../library/api\mct/intrusiveness.hpp(184) : error C2027: use of undefined type 'mct::impl::extern_use_wrapper<type>'
c:/users/scottk/work/dev/esp/current/develop/../library/api\mct/intrusiveness.hpp(185) : error C2027: use of undefined type 'mct::impl::extern_use_wrapper<type>'

Paul Pogonyshev (doublep) wrote :

Scott, I applied a fix (basically what you suggested by email) in 1.6 branch (lp:libmct/1.6 ). Can you please test it? If it is a problem to check out the branch with Bazaar on Windows, I can make a preliminary release for you.

Also, there is an extensive testsuite and it would be ideal if you could run that too, to make sure there are no other bugs, for instance. I guess that's not that easy on Windows, though, unless maybe if you have SCons.

Hi Paul,

I will try the fix, and also see if I can get the testquite running, but it will not be until the end of next week. I am swamped with work today, and out of the office Monday and Tuesday of next week.


PS> Also include the little patch for max being picked up as a macro in VS 2008

Paul Pogonyshev (doublep) wrote :

I don't understand. It picks function or macro depending on _whitespace_?

Sorry -- my stupidity, I thought that the whitespace fixed the braindead preprocessor, but it did not. the following patch does, although I hate undefining macros.

diff -c closed-hash-table.hpp-fixed closed-hash-table.hpp
*** closed-hash-table.hpp-fixed Fri Nov 9 14:39:37 2012
--- closed-hash-table.hpp Fri Nov 9 15:33:35 2012
*** 43,48 ****
--- 43,52 ----
  #include <mct/impl/optimization.hpp>
  #include <mct/impl/utils.hpp>

+ #if defined(_WINDOWS) || defined(_WIN32)
+ #undef min
+ #undef max
+ #endif

  // Internally data is stored in an array of buckets with length being some power of 2.
  // Tables come in two quite different variants: those where buckets keep hash values of

Paul Pogonyshev (doublep) wrote :

It seems Boost uses a "trick": every use of the function I see in their sources is in the form

    (std::numeric_limits <...>::max) ()

rather than

    std::numeric_limits <...>::max ()

I.e. they add parens that have no syntactic significance but (I guess) stop preprocessor from seeing this as a macro invocation.

Can you please verify if it solves the problem on VC++? I like this much better than #undef, which messes with non-MCT namespace...

That works fine. Sorry it took me so long to get back and test it out.

Paul Pogonyshev (doublep) wrote :

Sorry for not responding for so long. Can you please test 1.6 branch now, revision 256? Are there any other problems with VC++?

Paul Pogonyshev (doublep) wrote :

Note that I just release 1.6.1 with the fixes.

Changed in libmct:
status: New → Fix Released

I did just verify that everything is working correctly in all the unix variants I use, and in windows with Visual STudio 2008.

Again many thanks.

Paul Pogonyshev (doublep) wrote :

Great to know. Feel free to report any other problems you discover.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions