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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is GCC knows that main is only called once so the inlining is done
slightly different there.
If you name the function differently, GCC will do the inlining.
That is:
```
#include <iostream>
#include <tuple>

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);
    }
};

int h()
{
    A a{15, 30, 45};
    A b{20, 30, 40};

    std::cout << (a < b ? 'T' : 'F');
    return 0;
}
```
You will see it is inlined.

Reply via email to