public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/101124] New: [12 Regression] pair<T*, int>(0, 0) was intended to be deprecated, but is rejected now
Date: Fri, 18 Jun 2021 13:33:31 +0000	[thread overview]
Message-ID: <bug-101124-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101124
           Summary: [12 Regression] pair<T*, int>(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 <utility>
std::pair<long*, int> 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<long*, int> 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: candidate
1: 'constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _U1 =
long int*; _U2 = int; typename std::enable_if<(std::_PCC<true, _T1,
_T2>::_ConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1,
_T2>::_ImplicitlyConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = true;
_T1 = long int*; _T2 = 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: candidate
2: 'constexpr std::pair<_T1, _T2>::pair(std::pair<_T1,
_T2>::__null_ptr_constant, _U2&&) [with _U2 = int; typename std::enable_if<((!
std::__or_<std::is_same<_U2, const _T2&>, std::is_same<_U2, _T2&> >::value) &&
std::_PCC<true, _T1, _T2>::_DeprConsPair<true, std::nullptr_t, _U2>()),
bool>::type <anonymous> = true; _T1 = long int*; _T2 = int]'
  511 |        constexpr pair(__null_ptr_constant, _U2&& __y)
      |                  ^~~~


Maybe this is OK, because it's a non-standard feature and so rejecting it with
-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.

             reply	other threads:[~2021-06-18 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 13:33 redi at gcc dot gnu.org [this message]
2021-06-21  6:15 ` [Bug libstdc++/101124] " rguenth at gcc dot gnu.org
2021-09-25 20:08 ` redi at gcc dot gnu.org
2022-01-17 14:26 ` rguenth at gcc dot gnu.org
2022-01-18 11:11 ` redi at gcc dot gnu.org
2022-01-18 16:32 ` cvs-commit at gcc dot gnu.org
2022-01-18 16:37 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101124-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).