-
Notifications
You must be signed in to change notification settings - Fork 13.5k
vector<bool> fails to compile its (iterator, iterator) constructor #12446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is clearly a bug in Microsoft's STL implementation, because iterator_traits<_Iter1>::iterator_category must be preceded by 'typename'. That said, we could recover from this gracefully, and improve support for parsing Microsoft's broken STL implementation, |
Thanks Douglas, this makes sense. As a temporary workaround, I've locally created a "fake" header for xutility and just add -IC:\llvm_fake_headers to my compile-time flags. Here's the diff:
|
C:\LLVM\build\bin\Debug>clang -c -Xclang -cxx-abi -Xclang microsoft 12074.cpp -fsyntax-only It seems there are some conflicts with MSVC intrinsincs. |
The MS compiler provides its own <intrin.h> that includes a lot of other intrinsic headers for different subsets of CPU functionality (MMX, SSE, etc...) Some of them are provided by Clang build-in headers and they get picked up, but unfortunately, there are some problems with some defines being expected. If those are relaxed, then the compiler errors later because some macros are defined and Clang provides the intrinsincs as functions instead of extern declarations. I got a little farther with a custom <intrin.h> header based on the MinGW-w64 one, some of them need to be implemented in Clang itself, like the Interlocked* family of functions and some other stuff I did not yet research. Need some feedback on how we want to proceed on this. |
This seems fixed in MSVC 2012, can't even find traces of the problematic code in xutility. |
I see the same errors using MSVS 2012 and including . Is there a PR for this intrin.h issue? |
Yes, there is llvm/llvm-bugzilla-archive#13283 . |
The program in question links and runs. We have our own intrin.h header now. |
mentioned in issue llvm/llvm-bugzilla-archive#12477 |
Extended Description
$ clang++.exe --version
clang version 3.1 (trunk 150962)
Target: i686-pc-win32
Thread model: posix
$ more vector_bool.cpp
#include
int main() {
std::vector foo(NULL, NULL);
}
$ clang++.exe vector_bool.cpp
[3 errors including]
In file included from vector_bool.cpp:1:
In file included from c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:6:
In file included from c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\memory:6:
In file included from c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\iterator:6:
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility:995:3: error: template argument for template type parameter must be a type
iterator_traits<_Iter1>::iterator_category,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:1044:19: note: in instantiation of function template specialization 'stdext::unchecked_copy<unsigned
int *, unsigned int *>' requested here
pointer _Ptr = _STDEXT unchecked_copy(_VEC_ITER_BASE(_Last), _Mylast,
^
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\yvals.h:490:27: note: expanded from macro '_STDEXT'
#define _STDEXT ::stdext::
^
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:1097:3: note: in instantiation of member function 'std::vector<unsigned int, std::allocator >::erase' requested here
erase(begin(), end());
^
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:871:3: note: in instantiation of member function 'std::vector<unsigned int, std::allocator >::_Assign_n' requested here
_Assign_n(_Count, _Val);
^
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:1946:10: note: in instantiation of member function 'std::vector<unsigned int, std::allocator<unsigned
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector:1932:3: note: in instantiation of function template specialization 'std::vector<bool,
std::allocator >::_BConstruct' requested here
_BConstruct(_First, _Last, _Iter_cat(_First));
^
vector_bool.cpp:3:21: note: in instantiation of function template specialization 'std::vector<bool, std::allocator >::vector' requested here
std::vector foo(NULL, NULL);
^
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility:960:16: note: template parameter is declared here
template<class _Cat1, class _Cat2>
^
This prevents googletest from building under clang++
The text was updated successfully, but these errors were encountered: