<memory> header with clang

L B (3806)
I'm having trouble compiling this in clang:
1
2
3
4
5
#include <memory>

int main()
{
}
>clang++ -std=c++11 memory.cpp
In file included from memory.cpp:1:
In file included from c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\memory:75:
c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\ext/concurrence.h:228:2: error: no
      matching function for call to '_S_destroy'
        _S_destroy(&_M_mutex);
        ^~~~~~~~~~
c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\ext/concurrence.h:273:7: note:
      candidate template ignored: substitution failure [with _Rm =
      __gthread_recursive_mutex_t]: non-type template argument evaluates to 4,
      which cannot be narrowed to type 'bool'
      _S_destroy(_Rm* __mx)
      ^
c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\ext/concurrence.h:282:7: note:
      candidate template ignored: substitution failure [with _Rm =
      __gthread_recursive_mutex_t]: no member named 'actual' in
      '__gthread_recursive_mutex_t'
      _S_destroy(_Rm* __mx)
      ^
c:/MinGW/lib/gcc/mingw32/4.6.2/include/c++\ext/concurrence.h:290:7: note:
      candidate template ignored: substitution failure [with _Rm =
      __gthread_recursive_mutex_t]: no type named '__type' in
      '__gnu_cxx::__enable_if<false, void>'
      _S_destroy(_Rm* __mx)
      ^
1 error generated.
I also get errors from <functional> in sublime-clang. I don't know how to fix this, I've never had to mess with this kind of stuff before...
Branflakes91093 (144)
Some links that talk about this:
http://mostlybuggy.wordpress.com/2012/06/06/a-unique_ptr-problem-with-clang-on-mingw/
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/021863.html

Try adding that code snippet from the second link to concurrence.h.

This also seems like it was supposed to be patched (http://gcc.gnu.org/viewcvs?view=revision&revision=188646), are you using the latest version of mingw?
L B (3806)
Ah yeah, I seem to have both 4.6.2 and 4.7.2 and for some reason it is choosing 4.6.2 - I can't figure out how to change it so I backed up my 4.6.2 folder and made a copy of 4.7.2 as 4.6.2, and now it compiles. I'll try and figure out the proper way to do it though...
JLBorges (1754)
GCC versions 4.7.0 and 4.7.1 had changes to the C++ standard library which affected the ABI in C++11 mode ...
as a result C++11 code compiled with GCC 4.7.0 or 4.7.1 may be incompatible with C++11 code compiled with different GCC versions

http://gcc.gnu.org/gcc-4.7/changes.html




L B (3806)
That snippet is not relevant to me, but thanks.
Registered users can post here. Sign in or register to post.