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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a slightly reduced (still has std::vector in it):

#include <vector>

template<class A, class B>
struct Pair1
{
      constexpr Pair1(const Pair1&) = default;
      constexpr Pair1(Pair1&&) = default;
      constexpr Pair1(const A& __a, const B& __b)
      : first(__a), second(__b) { }
       Pair1&
      operator=(  const Pair1 &   __p)
      {
        first = __p.first;
        second = __p.second;
        return *this;
      }
  A first;
  B second;
};
typedef Pair1<int, int> Pair;

std::vector<Pair> f = {{0, -11}, {0, -8}, {1, 2}};

int foo(Pair x, Pair y) {
    return std::max(x.second, y.second);
}

int main() {
    int t = 0;
    for (int J = 0; J < 1; J++) {
        f[J] = f[0];
        if(J == 0)
            f[J] = f[2];
        t = foo(f[J], f[1]);
    }
    if (t != 2)
      __builtin_abort();
}

Reply via email to