cppguy / googletest

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

buggy IsContainerTest resolution code in gtest/gtest-printers.h gtest/internal/gtest-internal.h #447

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
this code does not work properly with ms compiler.
Because of this buggy code PerfSupportTest.cpp of ClangModernizeTests project 
from LLVM fails to compile when building it with Vs2008.

In short, this code resolves a map::iterator as if it was a container (error 
message at the bottom).
The reason for that is because iterator inherits from const_iterator in 
dinkumware lib, and for some reason typename C::iterator ends up resolving to 
member function pointer (to constructor). Here's test that demonstrates this 
error:
http://pastie.org/8484886

Here's the error when compiling ClangModernizeTests:

1>C:\work\llvm\utils\unittest\googletest\include\gtest/gtest-printers.h(275) : 
error C2039: 'begin' : is not a member of 'std::_Tree<_Traits>::iterator'
1>        with
1>        [
1>            
_Traits=std::_Tmap_traits<std::string,std::vector<PerfItem>,std::less<std::strin
g>,std::allocator<std::pair<const std::string,std::vector<PerfItem>>>,false>
1>        ]
1>        C:\vs\2008\VC\include\xtree(426) : see declaration of 
'std::_Tree<_Traits>::iterator'
1>        with
1>        [
1>            
_Traits=std::_Tmap_traits<std::string,std::vector<PerfItem>,std::less<std::strin
g>,std::allocator<std::pair<const std::string,std::vector<PerfItem>>>,false>
1>        ]

Original issue reported on code.google.com by pavlov.p...@gmail.com on 16 Nov 2013 at 2:05