FS#54276 - [clang] Latest gcc-libs (7.1.1) breaks clang in c++17 mode
Attached to Project:
Arch Linux
Opened by sergio (sergio) - Friday, 02 June 2017, 19:37 GMT
Last edited by Evangelos Foutras (foutrelis) - Saturday, 16 September 2017, 19:53 GMT
Opened by sergio (sergio) - Friday, 02 June 2017, 19:37 GMT
Last edited by Evangelos Foutras (foutrelis) - Saturday, 16 September 2017, 19:53 GMT
|
Details
Example:
#include <unordered_map> int main() { return 0; } $ clang -std=c++1z example.cpp In file included from a.cpp:1: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/unordered_map:47: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/hashtable.h:37: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/node_handle.h:39: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:27: error: use of class template 'optional' requires template arguments template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:451:11: note: template is declared here class optional ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:40: error: expected ';' at end of declaration template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:41: error: cannot use arrow operator on a type template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ 3 errors generated. clang from master branch works, so this seems to have been patched upstream already |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Saturday, 16 September 2017, 19:53 GMT
Reason for closing: Fixed
Additional comments about closing: clang 5.0.0-1
Saturday, 16 September 2017, 19:53 GMT
Reason for closing: Fixed
Additional comments about closing: clang 5.0.0-1
The changes to fix this are substantial and spread over many commits [2], so we will have to wait for a new clang release that officially supports this C++1z feature.
[1] https://clang.llvm.org/cxx_status.html#cxx17
[2] https://github.com/llvm-mirror/clang/search?utf8=%E2%9C%93&q=template+argument+deduction+for+class+templates&type=Commits
I *think* llvm/clang doesn't compile too, but that might have been my mistake and unrelated to this. Will double check.
You can compile C++17 projects just fine in GCC (I can live with that ;), but developing them with completion and static analysis based on clang can yield many errors.