From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A31D83AA9015; Fri, 18 Jun 2021 13:33:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A31D83AA9015 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/101124] New: [12 Regression] pair(0, 0) was intended to be deprecated, but is rejected now Date: Fri, 18 Jun 2021 13:33:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 13:33:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101124 Bug ID: 101124 Summary: [12 Regression] pair(0, 0) was intended to be deprecated, but is rejected now Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- r12-220-gd96db15967e78d7cecea3b1cf3169ceb924678ac intended to deprecate the non-standard constructors allowing this: #include std::pair p(0, 0); However, as reported in PR 100375 the hack doesn't work, and it triggers a warning (which is an error with -Wpedantic): pair.C:2:29: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: 2 | std::pair p(0, 0); | ^ In file included from /home/jwakely/gcc/12/include/c++/12.0.0/utility:70, from pair.C:1: /home/jwakely/gcc/12/include/c++/12.0.0/bits/stl_pair.h:426:17: note: candi= date 1: 'constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 = =3D long int*; _U2 =3D int; typename std::enable_if<(std::_PCC::_ConstructiblePair<_U1, _U2>() && std::_PCC::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type =3D = true; _T1 =3D long int*; _T2 =3D int]' 426 | constexpr pair(const _T1& __a, const _T2& __b) | ^~~~ /home/jwakely/gcc/12/include/c++/12.0.0/bits/stl_pair.h:511:18: note: candi= date 2: 'constexpr std::pair<_T1, _T2>::pair(std::pair<_T1, _T2>::__null_ptr_constant, _U2&&) [with _U2 =3D int; typename std::enable_i= f<((! std::__or_, std::is_same<_U2, _T2&> >::value)= && std::_PCC::_DeprConsPair()), bool>::type =3D true; _T1 =3D long int*; _T2 =3D int]' 511 | constexpr pair(__null_ptr_constant, _U2&& __y) | ^~~~ Maybe this is OK, because it's a non-standard feature and so rejecting it w= ith -Wpedantic might be OK. But my intention was to accept it with a deprecation warning for GCC 12, and only make it ill-formed for GCC 13. I need to see if it's possible to make it work as intended, and if not then just remove the hack and make it ill-formed for GCC 12.=