-
Notifications
You must be signed in to change notification settings - Fork 152
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
valarray のコードがコンパイルエラーになる #41
Comments
↓
コンパイル時に明示的にa_type型にしてあげればClang-HEADでも期待通りの結果が得られますね。 この問題の直接の原因は {'x','y'} を std::valarray の std::slice の operator= がClang-HEADではstd::valarrayに型変換されてくれない挙動のようです。 cpprefjpとしての問題は、このClangの挙動({'x','y'}をstd::valarray型に暗黙的に変換しない)がC++規格として正しいか、という事になるかと思います。 さしあたりは、Clang-HEADでコンパイルできない事の解決としても、明示的なコードとしても、冒頭に挙げたClang-HEADでもコンパイル可能なパターンへの変更をpull-reqしておきます。 |
libc++ の問題のように見えますね。 void operator=(const valarray<T>&) const; が無きゃならないのに、libc++ には template <class _Expr>
typename enable_if<__is_val_expr<_Expr>::value, void>::type operator=(const _Expr& __v) const; しかないです。 |
あ、かぶった… |
valarrayのサンプル2つめがClang-HEADでコンパイルできない事を受けての修正。 詳細: GitHub cpprefjp/site Issue #41
本来は元のままでもコンパイルされて然るべき、とは言え最新のClang++というかlibc++で通らないサンプルを注釈を付けて掲載するのもユーザーフレンドリーではありませんし、hotfixの対応はそれほど複雑化するものではないので、どなたか確認頂いた上でさしあたりはpull-reqの修正をmergeして頂ければいいかな、と思います。 と、同時にlibc++にバグ報告を挙げるべきででしょうか。 ※只今よりお仕事タイム的にしばらくスレッドに出没できなくなります。夕方以降にまたスレッド確認します。 |
バグ報告が終わったら Close する方向で。 |
バグレポの栄誉頂きました! http://llvm.org/bugs/show_bug.cgi?id=17814 #英文は気にしない方向で… |
ありがとうございます! |
https://github.com/cpprefjp/site/blob/master/reference/valarray/valarray.md の2番目のコードが Clang でコンパイルエラーになります。
http://melpon.org/wandbox/permlink/z5tIcHzSx6BeE3oD
gcc では発生しないのですが、どちらの方が正しいのかいまいち分からず…。
The text was updated successfully, but these errors were encountered: