[MacPorts] #70341: g++ fails to compile when -libstd=libc++ is set

MacPorts noreply at macports.org
Mon Jul 8 17:59:20 UTC 2024


#70341: g++ fails to compile when -libstd=libc++ is set
--------------------------+--------------------
  Reporter:  mouse07410   |      Owner:  (none)
      Type:  defect       |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  gcc12 gcc13  |
--------------------------+--------------------
Description changed by mouse07410:

Old description:

> 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> >&&'
> $
> }}}

New description:

 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> >&&'
 $
 }}}

--

-- 
Ticket URL: <https://trac.macports.org/ticket/70341#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list