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

            Bug ID: 110124
           Summary: Not inlining comparison operator when using std::tie
                    with -std=c++20
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vakili at live dot com
  Target Milestone: ---

Here is a simple class with a operator<():

struct A {
    int a0;
    int a1;
    int a2;

    friend inline constexpr bool operator<(const A& x, const A& y) {
        return std::tie(x.a0, x.a1, x.a2) < std::tie(y.a0, y.a1, y.a2);
    }
};

When compiling this code with -std=c++17 the operator will be inlined at usage
location. But when compiled with -std=c++20 it will not be inlined.

Here is the compiler explorer snippet showing the situation:
https://godbolt.org/z/4KdzWjvx4

The problem exists from g++ 10.0 to the trunk (14.0).

Reply via email to