jirzynek / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

The custom type_traits interfere with other code #82

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Test with chrome code
2.
3.

What is the expected output? What do you see instead?
Crazy compiler errors.

What version of the product are you using? On what operating system?
sparsehash v2.0.2
Visual studio 2010 sp1
windows 7 64 bit

Please provide any additional information below.

The popular compilers support the type_traits needed so the custom type_traits 
code should be removed or at least add the option to disable it.

Original issue reported on code.google.com by laboboL...@gmail.com on 24 Mar 2012 at 10:16

GoogleCodeExporter commented 9 years ago
} Crazy compiler errors

Can you be more specific?  The full compiler output would be most helpful.  The 
local sparsehash type_traits shouldn't interfere with any system type_traits, 
in theory.

Original comment by csilv...@gmail.com on 25 Mar 2012 at 1:15

GoogleCodeExporter commented 9 years ago
I thought it strange too, i can compile and run the test solution just fine. 
With just a solution upgrade to vs2010.

Here are the errors that popup when including #include 
"sparsehash\sparse_hash_map"
(with my modified version, custom type_traits removed, it compiles just fine)

See attached text file, I've included the chrome file the errors mention.

I've also included the quick and dirt version that compiles.
(i've stubbled on some vs2010 type trait bugs too, see modified 
src\type_traits_unittest.cc)

Original comment by laboboL...@gmail.com on 25 Mar 2012 at 2:09

Attachments:

GoogleCodeExporter commented 9 years ago
Not sure the bind_internal errors mean anything; after the errors in 
type_traits.h all bets are off as to what the parser is thinking.

The errors you're seeing are definitely odd:
} 1>sparsehash/type_traits.h(95): error C2504: 'true_type' : base class 
undefined

But true_type *is* defined, in template_util.h, which type_traits.h #includes.  
Is MSVC not #including template_util.h somehow?  Or not putting true_type into 
the correct (google) namespace?  Or something else?

One possibility is that another header file somewhere is defining 
_BASE_TEMPLATE_UTIL_H_.  That's not totally implausible with Chromium code, 
which likely follows google style as to how to name .h header guards.  Try 
changing the _BASE_TEMPLATE_UTIL_H_ to _SPARSEHASH_TEMPLATE_UTIL_H_ in 
template_util.h (in several places) and see if that helps.

Otherwise, you may have to poke around a bit to see why MSVC isn't seeing the 
code.

Original comment by csilv...@gmail.com on 25 Mar 2012 at 4:20