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.

Reply via email to