public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/101124] New: [12 Regression] pair<T*, int>(0, 0) was intended to be deprecated, but is rejected now
@ 2021-06-18 13:33 redi at gcc dot gnu.org
  2021-06-21  6:15 ` [Bug libstdc++/101124] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-18 13:33 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-18 16:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 13:33 [Bug libstdc++/101124] New: [12 Regression] pair<T*, int>(0, 0) was intended to be deprecated, but is rejected now redi at gcc dot gnu.org
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

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).