Opened 3 months ago

Last modified 3 months ago

#70341 new defect

g++ fails to compile when -libstd=libc++ is set — at Version 1

Reported by: mouse07410 (Mouse) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), cjones051073 (Chris Jones)
Port: gcc12 gcc13 gcc14

Description (last modified by mouse07410 (Mouse))

This problem started with GCC12, and continues with GCC13. Also, GCC14 - but that one simply doesn't work, so better to concentrate on releases that otherwise do compile successfully.

File in question t3.cpp:

#include <iostream>

int main() {
     std::cout << "Hello World!" << std::endl;
     return 0;
}

"Normal" compilation:

$ g++-mp-13 -pipe  -o t3 t3.cpp
$ ./t3
Hello World!
$ 

Attempt to compile with -libstd=libc++:

$ g++-mp-13 -pipe -stdlib=libc++ -o t3 t3.cpp
In file included from /opt/local/libexec/gcc13/libc++/include/c++/v1/__concepts/convertible_to.h:13,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/__concepts/common_reference_with.h:12,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/__compare/three_way_comparable.h:14,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/__compare/compare_three_way.h:13,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/__memory/shared_ptr.h:14,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/mutex:191,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/__locale:18,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/ios:221,
                 from /opt/local/libexec/gcc13/libc++/include/c++/v1/iostream:43,
                 from t3.cpp:1:
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:71:8: error: expected identifier before '__is_convertible'
   71 | struct __is_convertible
      |        ^~~~~~~~~~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:71:8: error: expected unqualified-id before '__is_convertible'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:77:40: error: expected identifier before '__is_convertible'
   77 | template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
      |                                        ^~~~~~~~~~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:77:40: error: expected unqualified-id before '__is_convertible'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:78:40: error: expected identifier before '__is_convertible'
   78 | template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
      |                                        ^~~~~~~~~~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:78:40: error: expected unqualified-id before '__is_convertible'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:79:40: error: expected identifier before '__is_convertible'
   79 | template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
      |                                        ^~~~~~~~~~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:79:40: error: expected unqualified-id before '__is_convertible'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__type_traits/is_convertible.h:80:40: error: expected identifier before '__is_convertible'
   80 | template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
.  .  .
/opt/local/libexec/gcc13/libc++/include/c++/v1/__thread/poll_with_backoff.h:51:15:   required from 'bool std::__1::__libcpp_thread_poll_with_backoff(_Fn&&, _BFn&&, chrono::nanoseconds) [with _Fn = __cxx_atomic_wait_test_fn_impl<const volatile __cxx_atomic_impl<bool>, bool>&; _BFn = __libcpp_atomic_wait_backoff_impl<const volatile __cxx_atomic_impl<bool>, __cxx_atomic_wait_test_fn_impl<const volatile __cxx_atomic_impl<bool>, bool> >&; chrono::nanoseconds = chrono::duration<long long int, ratio<1, 1000000000> >]'
/opt/local/libexec/gcc13/libc++/include/c++/v1/atomic:1482:50:   required from 'bool std::__1::__cxx_atomic_wait(_Atp*, _Fn&&) [with _Atp = const volatile __cxx_atomic_impl<bool>; _Fn = __cxx_atomic_wait_test_fn_impl<const volatile __cxx_atomic_impl<bool>, bool>&]'
/opt/local/libexec/gcc13/libc++/include/c++/v1/atomic:1515:34:   required from 'bool std::__1::__cxx_atomic_wait(_Atp*, _Tp, memory_order) [with _Atp = const volatile __cxx_atomic_impl<bool>; _Tp = bool; memory_order = memory_order]'
/opt/local/libexec/gcc13/libc++/include/c++/v1/atomic:2376:27:   required from here
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:247:9: note: candidate: 'std::__1::chrono::duration<_Rep, _Period>::duration() [with _Rep = long long int; _Period = std::__1::ratio<1, 1000000000>]'
  247 |         duration() = default;
      |         ^~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:247:9: note:   candidate expects 0 arguments, 1 provided
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:202:28: note: candidate: 'constexpr std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >::duration(const std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >&)'
  202 | class _LIBCPP_TEMPLATE_VIS duration
      |                            ^~~~~~~~
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:202:28: note:   no known conversion for argument 1 from 'std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >::rep' {aka 'long long int'} to 'const std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >&'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:202:28: note: candidate: 'constexpr std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >::duration(std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >&&)'
/opt/local/libexec/gcc13/libc++/include/c++/v1/__chrono/duration.h:202:28: note:   no known conversion for argument 1 from 'std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >::rep' {aka 'long long int'} to 'std::__1::chrono::duration<long long int, std::__1::ratio<1, 1000000000> >&&'
$ 

Change History (2)

Changed 3 months ago by mouse07410 (Mouse)

Attachment: g++-t3-log.txt added

Complete output of compilation (1570 lines)

comment:1 Changed 3 months ago by mouse07410 (Mouse)

Description: modified (diff)
Note: See TracTickets for help on using tickets.