Bug 1485643
| Summary: | Clang fails on std::optional | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Georg Sauthoff <fedora> |
| Component: | clang | Assignee: | Dave Airlie <airlied> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 27 | CC: | airlied, davejohansen, plroskin, sbergman, siddharth.kde, tstellar |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-01-16 00:12:42 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Fedora 27 is also affected. clang-5 should fix the issue. The issue is resolved in Fedora 27 by clang-5.0.0-1.fc27.x86_64 I don't see a clang 5 update for Fedora 26 at this time: https://koji.fedoraproject.org/koji/packageinfo?packageID=21848 So I'm afraid it's WONTFIX for Fedora 26. Fixed in 5.0.0-1.fc27. |
Description of problem: Compiling a C++ program that includes <optional> yields a compile error with clang++. Version-Release number of selected component (if applicable): clang-4.0.0-3.fc26.x86_64 How reproducible: always Steps to Reproduce: 1. $ cat > test_optional.cc #include <optional> int main() { return 0; } 2. clang++ -std=c++1z test_optional.cc 3. Actual results: In file included from test_optional.cc:1: /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:27: error: use of class template 'optional' requires template arguments template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:451:11: note: template is declared here class optional ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:40: error: expected ';' at end of declaration template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:41: error: cannot use arrow operator on a type template <typename _Tp> optional(_Tp) -> optional<_Tp>; ^ 3 errors generated. Expected results: No compile errors, successful compilation. Additional info: It works with g++ as expected: $ g++ -std=c++1z test_optional.cc Apparently, the libstdc++ which is also used by Fedora's clang++ implements std::optional in a way that is not (yet) supported by clang. See also: https://bugs.archlinux.org/index.php?do=details&task_id=54276