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

--- Comment #9 from Ruslan Nikolaev <nruslan_devel at yahoo dot com> ---
Interestingly, if I change the code a little bit and have a pair in the
constructor rather than two arguments, gcc seems to compile the code:

#include <iostream>
#include <utility>

struct PairPtr {

    PairPtr() {}

    PairPtr(const PairPtr &s) {
        a = s.a;
        b = s.b;
    }

    explicit PairPtr(const std::pair<int *, int *>& pair) {
        a = pair.first;
        b = pair.second;
    }

    PairPtr& operator=(const PairPtr &s) {
        a = s.a;
        b = s.b;
        return *this;
    }

    PairPtr& operator=(const std::pair<int *, int *>& pair) {
        a = pair.first;
        b = pair.second;
        return *this;
    }

private:
    int *a;
    int *b;
};

void func(int *a, int *b)
{
    PairPtr p({a,b}); // works

    p = { a, b }; // also works
}

Reply via email to