From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3A11385559E; Sun, 4 Dec 2022 04:19:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3A11385559E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670127541; bh=6LAXc60eeBLPfx2qLnsFg/7DQj0kOmFQtLxrSWl+rXw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pZcIaLm30qfzE6YfiJWHs3i1orC7Dd7navwB6Jju2LXz+QSWsiIbnPI42E/gA2iY7 Zo6VnO2cYjjZtGdMPoUZlJQumPTmclBvBNXELqhklEfZ8ADo+A8CIwXANrPbhKIhlU F7/f/6nNCe3+IhOfDaUhkExe7U0fmFAOVeq2VpMI= From: "nruslan_devel at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107958] Ambiguity with uniform initialization in overloaded operator and explicit constructor Date: Sun, 04 Dec 2022 04:19:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nruslan_devel at yahoo dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107958 --- Comment #9 from Ruslan Nikolaev --- 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 #include struct PairPtr { PairPtr() {} PairPtr(const PairPtr &s) { a =3D s.a; b =3D s.b; } explicit PairPtr(const std::pair& pair) { a =3D pair.first; b =3D pair.second; } PairPtr& operator=3D(const PairPtr &s) { a =3D s.a; b =3D s.b; return *this; } PairPtr& operator=3D(const std::pair& pair) { a =3D pair.first; b =3D pair.second; return *this; } private: int *a; int *b; }; void func(int *a, int *b) { PairPtr p({a,b}); // works p =3D { a, b }; // also works }=