Bug 1459393 - clang fails with -std=c++17 or -std=c++1z on programs that use <future>
clang fails with -std=c++17 or -std=c++1z on programs that use <future>
Status: NEW
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
26
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jonathan Wakely
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-06 23:12 EDT by Eric Hopper
Modified: 2017-06-07 16:04 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eric Hopper 2017-06-06 23:12:11 EDT
Description of problem:
This small program fails to compile

------small.cpp------
#include <future>

int main()
{
   return 0;clang-4.0.0-3.fc26.x86_64
}
---------------------

with clang++ -std=c++1z small.cpp
or clang++ -std=c++1z small.cpp

Version-Release number of selected component (if applicable):

libstdc++-devel-7.1.1-2.fc26.x86_64
clang-4.0.0-3.fc26.x86_64

How reproducible:

Every time.

Steps to Reproduce:
1.Create small.cpp
2.Do clang++ -std=c++17 small.cpp
3.Observe the resulting errors

Actual results:

In file included from small.cpp:1:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/future:38:
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/mutex:672:4: error: 
      no matching function for call to '__invoke'
          std::__invoke(std::forward<_Callable>(__f),
          ^~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/future:401:2: note: 
      in instantiation of function template specialization 'std::call_once<void
      (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *),
      std::__future_base::_State_baseV2 *,
      std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *>' requested here
        call_once(_M_once, &_State_baseV2::_M_do_set, this,
        ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:89:5: note: 
      candidate template ignored: substitution failure [with _Callable = void
      (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *), _Args =
      <std::__future_base::_State_baseV2 *,
      std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *>]: no type named
      'type' in 'std::__invoke_result<void
      (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *),
      std::__future_base::_State_baseV2 *,
      std::function<std::unique_ptr<std::__future_base::_Result_base,
      std::__future_base::_Result_base::_Deleter> ()> *, bool *>'
    __invoke(_Callable&& __fn, _Args&&... __args)
    ^
In file included from small.cpp:1:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/future:38:
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/mutex:672:4: error: 
      no matching function for call to '__invoke'
          std::__invoke(std::forward<_Callable>(__f),
          ^~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/future:1646:27: note: 
      in instantiation of function template specialization 'std::call_once<void
      (std::thread::*)(), std::thread *>' requested here
    void _M_join() { std::call_once(_M_once, &thread::join, &_M_thread); }
                          ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/invoke.h:89:5: note: 
      candidate template ignored: substitution failure [with _Callable = void
      (std::thread::*)(), _Args = <std::thread *>]: no type named 'type' in
      'std::__invoke_result<void (std::thread::*)(), std::thread *>'
    __invoke(_Callable&& __fn, _Args&&... __args)
    ^
2 errors generated.


Expected results:

A nice a.out file that does nothing
Comment 2 Jonathan Wakely 2017-06-07 10:02:02 EDT
We should consider removing the libstdc++so7 component in bugzilla, it just confuses users. This has nothing to do with libstdc++so7.
Comment 3 Jonathan Wakely 2017-06-07 11:33:16 EDT
Clang doesn't support the GNU extension that libstdc++ relies on for deducing noexcept on a function type, which is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80690 and reported to Clang as https://bugs.llvm.org/show_bug.cgi?id=32974
Comment 4 Eric Hopper 2017-06-07 16:03:37 EDT
What is the right component to report this against then?
Comment 5 Eric Hopper 2017-06-07 16:04:07 EDT
Oh, sorry, nevermind. I missed the component switching to gcc.

Note You need to log in before you can comment on or make changes to this bug.