<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Not sure if it helps your specific
case, but you do need to patch gcc 4.7's libstdc++ before you can
use it with clang.<br>
<br>
<a href="http://clang.llvm.org/libstdc++4.7-clang11.patch">http://clang.llvm.org/libstdc++4.7-clang11.patch</a><br>
<br>
- ½<br>
<br>
On 13-10-29 10:37 AM, Jesper Eskilson wrote:<br>
</div>
<blockquote cite="mid:526FC80E.7030900@iar.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<br>
Hi,<br>
<br>
I've gotten stuck on a weird error message from Clang. I'm writing
a Clang-based tool to analyze legacy C++ source code. The code
relies heavily on Windows-specific headers files (MFC, etc) and I
have never been able to get Clang to properly parse MS own header
files. Running the tool on Linux works fine; I've created a set of
dummy replacement header files which are complete enough to allow
Clang to build a usable AST for me. However, running the tool on
Windows turns out to be more difficult than I thought.<br>
<br>
I've tried several approaches as to what header files should be
used. Clang was never able to get through the MS header files
without crashing or producing various errors. Since the tool
worked fine on Linux, I imagined that it should be possible to use
Linux header files instead. This got me pretty far, but now I've
gotten stuck on an error which I cannot make sense of.<br>
<br>
<blockquote type="cite">$ clang -fno-ms-extensions -D_GNU_SOURCE
-c foo.cpp -isystem ./linux-glibc/include -isystem
./linux-glibc/include/c++/4<br>
.7 -isystem ./linux-glibc/include/c++/4.7/bits -isystem
linux-glibc/include/c++/4.7/x86_64-linux-gnu<br>
In file included from foo.cpp:1:<br>
In file included from ./linux-glibc/include/c++/4.7\vector:63:<br>
In file included from
./linux-glibc/include/c++/4.7\bits/stl_construct.h:63:<br>
In file included from
./linux-glibc/include/c++/4.7\ext/alloc_traits.h:35:<br>
./linux-glibc/include/c++/4.7\bits/alloc_traits.h:56:35: error:
in-class initializer for static data member is not a<br>
constant expression<br>
static const bool __value = _S_chk<_Alloc,
_Tp>(nullptr);<br>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
./linux-glibc/include/c++/4.7\bits/alloc_traits.h:63:19: note:
in instantiation of template class<br>
'std::__alloctr_rebind_helper<std::allocator<int>,
int>' requested here<br>
bool = __alloctr_rebind_helper<_Alloc,
_Tp>::__value><br>
^<br>
./linux-glibc/include/c++/4.7\bits/alloc_traits.h:201:9: note:
in instantiation of default argument for<br>
'__alloctr_rebind<std::allocator<int>, int>'
required here<br>
using rebind_alloc = typename
__alloctr_rebind<_Alloc, _Tp>::__type;<br>
^~~~~<br>
./linux-glibc/include/c++/4.7\ext/alloc_traits.h:183:47: note:
in instantiation of template type alias 'rebind_alloc'<br>
requested here<br>
{ typedef typename _Base_type::template
rebind_alloc<_Tp> other; };<br>
^<br>
./linux-glibc/include/c++/4.7\bits/stl_vector.h:75:59: note: in
instantiation of template class<br>
'__gnu_cxx::__alloc_traits<std::allocator<int>
>::rebind<int>' requested here<br>
typedef typename
__gnu_cxx::__alloc_traits<_Alloc>::template<br>
^<br>
./linux-glibc/include/c++/4.7\bits/stl_vector.h:208:30: note: in
instantiation of template class 'std::_Vector_base<int,<br>
<br>
std::allocator<int> >' requested here<br>
class vector : protected _Vector_base<_Tp, _Alloc><br>
^<br>
foo.cpp:2:18: note: in instantiation of template class
'std::vector<int, std::allocator<int> >' requested
here<br>
std::vector<int> foo;<br>
^</blockquote>
<br>
foo.cpp is a really simple source file which looks like this:<br>
<br>
// foo.cpp<br>
#include <vector><br>
std::vector<int> foo;<br>
// end<br>
<br>
The "linux-glibc/include" is a pretty large directory containing
the entire /usr/include directory from my Linux machine.<br>
<br>
Compiling the same program on Linux works fine. I've compared the
include file order, preprocessor symbols, and the list of options
being passed to the compiler driver ('clang -v ... foo.cpp'), and
I cannot find anything significant which is different. (Some
things are naturally different; for example Clang on Windows is
compiling 32-bit binaries, while my Linux-Clang is building 64-bit
ones).<br>
<br>
Are there other internal differences between Clang when run on
Windows vs. Linux which may account for this?<br>
<br>
<div class="moz-signature">-- <br>
<span style="color: #a6a6a6; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><strong>Jesper
Eskilson</strong></span> <span style="color: #fdb913;
font-family: arial,helvetica,sans-serif; font-size: 10pt;"><em>Development
Engineer</em></span><br>
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
E-mail: <a moz-do-not-send="true"
href="mailto:jesper.eskilson@iar.com"> <span style="color:
#808080; font-family: arial,helvetica,sans-serif;
font-size: 10pt;">jesper.eskilson@iar.com</span></a>
Website: <a moz-do-not-send="true" href="http://www.iar.com">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.iar.com<br>
</span></a> Twitter: <a moz-do-not-send="true"
href="http://www.twitter.com/iarsystems"> <span
style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.twitter.com/iarsystems</span></a>
</span> </div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>