ext/concurrence.h on C++11

先日、久しぶりにC++のコードを書くついでに環境を構築し直そうと、
Clang3.2とVimのプラグインを整えていざコードを書いている時の話です。*1MinGWgccは4.6.2)

コンパイルが通らなかったので、エラーを見てみると次のようなものでした。

\MinGW\lib\gcc\mingw32\4.6.2\include\c++\ext\concurrence.h|228 col 2| error: no matching function for call to '_S_destroy'
||         _S_destroy(&_M_mutex);
||         ^~~~~~~~~~
\MinGW\lib\gcc\mingw32\4.6.2\include\c++\ext\concurrence.h|273 col 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)
||       ^
\MinGW\lib\gcc\mingw32\4.6.2\include\c++\ext\concurrence.h|282 col 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)
||       ^
\MinGW\lib\gcc\mingw32\4.6.2\include\c++\ext\concurrence.h|290 col 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.

調べてみると、下記のページが見つかりました。
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/021863.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53578

どうやらlibstdc++のバグらしいです。
てなわけで早速
http://gcc.gnu.org/viewcvs?view=revision&revision=188646
から2つのファイルを落としてきて、mingwのファイルに置き換えると、見事に動きました。

C:/MinGW/lib/gcc/mingw32/4.6.2/include/c++/ext/concurrence.h line273の
sizeof(&_Rm::sema)の前に(bool)をつけるだけでいいそうです。
申し訳ありません。
教えて下さった方ありがとうございました。完全に読み飛ばしてました。

コメント見てると、自分はまだまだわからないことがあると実感しましたorz
これぐらいのこともわからないなんて・・・日々精進いたします。

*1:clangがgcc4.7.0のlibstd++に対応していないと聞いていたので、4.6.2にしました。