public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type
@ 2021-03-31  9:26 nilsgladitz at gmail dot com
  2021-03-31  9:56 ` [Bug libstdc++/99846] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: nilsgladitz at gmail dot com @ 2021-03-31  9:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

            Bug ID: 99846
           Summary: [11 regression] std::variant comparison operator error
                    for recursive type
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nilsgladitz at gmail dot com
  Target Milestone: ---

Created attachment 50491
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50491&action=edit
Test case source code

The attached source is a test case I reduced from a JSON like library that uses
std::variant to store alternate value types.

This still builds with GCC 10.2.0 but fails in 11.0.1 (g65374af219f) with:

/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:893:10:   required by
substitution of ‘template<class _Tp, class _Up> constexpr auto
std::__detail::_Synth3way::operator()(const _Tp&, const _Up&) const requires
requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:894:10:   required by
substitution of ‘template<class _Tp, class _Up> constexpr auto
std::__detail::_Synth3way::operator()(const _Tp&, const _Up&) const requires
requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:307:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:308:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:309:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:310:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:311:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:312:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:313:10:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:424:8:   required from ‘static
constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const _Up*)
[with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:884:27:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:884:52:   required from
‘static constexpr bool std::__detail::_Synth3way::_S_noexcept(const _Tp*, const
_Up*) [with _Tp = Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:890:32:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:901:16:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself
/opt/gcc/git-snapshot/include/c++/11.0.1/compare: In substitution of
‘template<class ... _Types>  requires (three_way_comparable<_Types,
std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’:
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:903:21:   required from
‘constexpr auto std::__detail::_Synth3way::operator()(const _Tp&, const _Up&)
const requires requires{{std::__detail::_Synth3way::operator()::__t <
std::__detail::_Synth3way::operator()::__u} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>,
>];{std::__detail::_Synth3way::operator()::__u <
std::__detail::_Synth3way::operator()::__t} -> decltype(auto) [requires
std::__detail::__boolean_testable<<placeholder>, >];} [with _Tp = Value; _Up =
Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/compare:914:34:   required by
substitution of ‘template<class _Tp, class _Up> using __synth3way_t = decltype
(std::__detail::__synth3way(declval<_Tp&>(), declval<_Up&>())) [with _Tp =
Value; _Up = Value]’
/opt/gcc/git-snapshot/include/c++/11.0.1/bits/stl_list.h:2030:5:   required by
substitution of ‘template<class _Tp, class _Alloc>
std::__detail::__synth3way_t<_T1> std::operator<=>(const
std::__cxx11::list<_Tp, _Alloc>&, const std::__cxx11::list<_Tp, _Alloc>&) [with
_Tp = Value; _Alloc = std::allocator<Value>]’
/opt/gcc/git-snapshot/include/c++/11.0.1/concepts:306:10:   required by
substitution of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&) [with _Types = {std::__cxx11::list<Value,
std::allocator<Value> >}]’
test.cpp:16:16:   required from here
/opt/gcc/git-snapshot/include/c++/11.0.1/variant:1218:5:   required by the
constraints of ‘template<class ... _Types>  requires
(three_way_comparable<_Types, std::partial_ordering> && ...) constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<_Types,
_Types>...> std::operator<=>(const std::variant<_Types ...>&, const
std::variant<_Types ...>&)’
cc1plus: error: satisfaction of atomic constraint
‘(three_way_comparable<_Types, std::partial_ordering> && ...) [with _Types =
{_Types ...}]’ depends on itself

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
@ 2021-03-31  9:56 ` rguenth at gcc dot gnu.org
  2021-04-08 13:24 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-31  9:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
           Keywords|                            |rejects-valid
      Known to work|                            |10.2.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
  2021-03-31  9:56 ` [Bug libstdc++/99846] " rguenth at gcc dot gnu.org
@ 2021-04-08 13:24 ` rguenth at gcc dot gnu.org
  2021-04-08 13:41 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-08

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  It works with -std=c++17 but fails on trunk with -std=c++20 (where
it works on the branch).

Needs investigation.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
  2021-03-31  9:56 ` [Bug libstdc++/99846] " rguenth at gcc dot gnu.org
  2021-04-08 13:24 ` rguenth at gcc dot gnu.org
@ 2021-04-08 13:41 ` redi at gcc dot gnu.org
  2021-04-08 13:42 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-08 13:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That's because C++20 <=> comparisons aren't present on the branch. They were
added by g:9e58988061f4175896de11af0caf9bdd48c9b046

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-08 13:41 ` redi at gcc dot gnu.org
@ 2021-04-08 13:42 ` redi at gcc dot gnu.org
  2021-04-08 13:46 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-08 13:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Actually that's not true, that commit *is* on the gcc-10 branch. I'll bisect.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-08 13:42 ` redi at gcc dot gnu.org
@ 2021-04-08 13:46 ` redi at gcc dot gnu.org
  2021-04-13 14:33 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-08 13:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Preprocessing the attached testcase with GCC 10 (using -std=c++20) and
compiling  with GCC 11 shows the error. Possibly a compiler bug (or invalid
code in the library, which gcc 10 doesn't complain about).

It started to fail on trunk with r11-2774

    c++: Check satisfaction before non-dep convs. [CWG2369]

    It's very hard to use concepts to protect a template from hard errors due
to
    unwanted instantiation if constraints aren't checked until after doing all
    substitution and checking of non-dependent conversions.

    It was pretty straightforward to insert the satisfaction check into the
    logic, but I needed to make the 3-parameter version of
    satisfy_declaration_constraints call push_tinst_level like the 2-parameter
    version already does.  For simplicity, I also made it add any needed outer
    template arguments from the TEMPLATE_DECL to the args.

    The testsuite changes are mostly because this change causes unsatisfaction
    to cause deduction to fail rather than reject the candidate later in
    overload resolution.

    gcc/cp/ChangeLog:

            DR 2369
            * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
            * constraint.cc (satisfy_declaration_constraints):
            Use add_outermost_template_args and push_tinst_level.
            * pt.c (add_outermost_template_args): Handle getting
            a TEMPLATE_DECL as the first argument.
            (push_tinst_level, push_tinst_level_loc): No longer static.
            (fn_type_unification): Check satisfaction before non-dependent
            conversions.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-08 13:46 ` redi at gcc dot gnu.org
@ 2021-04-13 14:33 ` redi at gcc dot gnu.org
  2021-04-13 14:42 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-13 14:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We can reduce this further:

#include <variant>
#include <list>

struct Value;

using Array = std::list<Value>;
using Variant = std::variant<Array>;

struct Value : Variant {};

int main()
{
        Value left;
        Value right;

        return left < right;
}

Now this is *obviously* wrong. The left < right expression uses the operator<
defined for the std::list<Value> base class, which depends on comparing the
list's elements, which obviously recurses.

Adding std::variant doesn't really change anything. The operator< for
std::variant depends on comparing its alternative types, which is a list of the
variants.

I don't see how this can work when implemented as required by the standard.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-13 14:33 ` redi at gcc dot gnu.org
@ 2021-04-13 14:42 ` redi at gcc dot gnu.org
  2021-04-13 15:06 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-13 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops, sorry, I meant to paste this as the further reduced version:

#include <list>

struct Value;

using Array = std::list<Value>;

struct Value : Array {};

int main()
{
        Value left;
        Value right;

        return left < right;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-13 14:42 ` redi at gcc dot gnu.org
@ 2021-04-13 15:06 ` ppalka at gcc dot gnu.org
  2021-04-13 18:27 ` nilsgladitz at gmail dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-13 15:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Before CWG 2369 (i.e. in GCC 10), for the original testcase, overload
resolution for 'left < right' would reject the operator<=> candidate due to
substitution failure into its return type before ever checking its loopy
constraints, and because we also define the (non-constrained) relational
operators for std::variant alongside operator<=>, overload resolution would
just end up selecting the explicitly defined operator<.

After CWG 2369 (i.e. in GCC 11), we check constraints sooner during overload
resolution, so when considering the operator<=> candidate we end up looping
during constraint checking, which we consider to be a fatal error.

Distilled testcase that exhibits the issue:

template <typename L, typename R> concept comparable_with = requires(L l, R r)
{ l < r; };

template <typename b> concept comparable = comparable_with<b, b>;

template <typename> class variant;

template <typename T> void operator<(variant<T>, variant<T>);

template <typename T> requires(comparable<T>)
typename T::fail operator<=>(variant<T>, variant<T>);

template <typename> class variant {};

struct g;
struct g : variant<g> {};
int main()
{
  g left, right;
  left < right;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (7 preceding siblings ...)
  2021-04-13 15:06 ` ppalka at gcc dot gnu.org
@ 2021-04-13 18:27 ` nilsgladitz at gmail dot com
  2021-04-13 20:25 ` redi at gcc dot gnu.org
  2021-04-13 20:47 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: nilsgladitz at gmail dot com @ 2021-04-13 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #8 from Nils Gladitz <nilsgladitz at gmail dot com> ---
(In reply to Jonathan Wakely from comment #5)
> Now this is *obviously* wrong. The left < right expression uses the
> operator< defined for the std::list<Value> base class, which depends on
> comparing the list's elements, which obviously recurses.

Maybe my original test case was reduced a bit too far.
Recursive but bounded example which maybe is a little closer to the original
case and I hope maybe a little less obviously wrong:

#include <list>
#include <iostream>
#include <variant>

struct Value;

using Array = std::list<Value>;
using Variant = std::variant<int, Array>;

struct Value : Variant
{
    using Variant::variant;
};

int main()
{
    Value left = Array{2, Array{}, 3};
    Value right = Array{1};

    std::cout << "<\t" << (left < right) << std::endl;
    std::cout << ">\t" << (left > right) << std::endl;
    std::cout << "==\t" << (left == right) << std::endl;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (8 preceding siblings ...)
  2021-04-13 18:27 ` nilsgladitz at gmail dot com
@ 2021-04-13 20:25 ` redi at gcc dot gnu.org
  2021-04-13 20:47 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-13 20:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This still means that comparisons on Value objects use the comparison operators
from the Variant base, and those comparisons depend on the alternative types in
the variant. One of those is list<Value>, and comparisons for list<Value>
depend on comparisons for Value. You are back where you started.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/99846] [11 regression] std::variant comparison operator error for recursive type
  2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
                   ` (9 preceding siblings ...)
  2021-04-13 20:25 ` redi at gcc dot gnu.org
@ 2021-04-13 20:47 ` redi at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-13 20:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99846

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #7)
> After CWG 2369 (i.e. in GCC 11), we check constraints sooner during overload
> resolution, so when considering the operator<=> candidate we end up looping
> during constraint checking, which we consider to be a fatal error.

Jason suggested adding a constraint to variant's operator<=> so that
satisfaction would fail before we try the loopy part. But I don't know how to
do that.

I think both G++ and libstdc++ are behaving correctly here, and I can't think
of a non-standard change we could make to support it. So closing as not a bug.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-04-13 20:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  9:26 [Bug libstdc++/99846] New: [11 regression] std::variant comparison operator error for recursive type nilsgladitz at gmail dot com
2021-03-31  9:56 ` [Bug libstdc++/99846] " rguenth at gcc dot gnu.org
2021-04-08 13:24 ` rguenth at gcc dot gnu.org
2021-04-08 13:41 ` redi at gcc dot gnu.org
2021-04-08 13:42 ` redi at gcc dot gnu.org
2021-04-08 13:46 ` redi at gcc dot gnu.org
2021-04-13 14:33 ` redi at gcc dot gnu.org
2021-04-13 14:42 ` redi at gcc dot gnu.org
2021-04-13 15:06 ` ppalka at gcc dot gnu.org
2021-04-13 18:27 ` nilsgladitz at gmail dot com
2021-04-13 20:25 ` redi at gcc dot gnu.org
2021-04-13 20:47 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).