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

            Bug ID: 124058
           Summary: [15 Regression] 20_util/pair/cons/99957.cc no longer
                    generate expected warnings with -std=gnu++1[147]
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: azoff at gcc dot gnu.org
  Target Milestone: ---

After r15-5461-g59fbdb3a871585, the test case 20_util/pair/cons/99957.cc no
longer generate the expected warnings on arm-none-eabi when building with
-std=gnu++17, -std=gnu++14 or -std=gnu++11.

Example command line used:
arm-none-eabi-g++ -fmessage-length=0 -fno-show-column -g -O2 -DLOCALEDIR="."
-I/build/gcc_src/libstdc++-v3/testsuite/util
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc -mthumb
-march=armv6s-m -mtune=cortex-m0 -mfloat-abi=soft -mfpu=auto -std=c++17
-Wdeprecated -U_GLIBCXX_USE_DEPRECATED -D_GLIBCXX_USE_DEPRECAT
ED=1 -fdiagnostics-plain-output -S -o /dev/null


With r15-5460-ga4842917dcb8e6, the following is emitted:
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc:25:47:
warning: 'constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant,
_U2&&, ...) [with _U2 = MoveOnly; typename
std::enable_if<std::__and_<std::is_pointer<_Tp>,
std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>,
std::__not_<std::is_constructible<_T1, const _U1&> >,
std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> =
false; _T1 = int*; _T2 = ExplicitMoveOnly]' is deprecated: use 'nullptr'
instead of '0' to initialize std::pair of move-only type and pointer
[-Wdeprecated-declarations]
   25 | pair<int*, ExplicitMoveOnly> v14(0, MoveOnly{}); // { dg-warning
"deprecated" }
      |                                               ^
In file included from
/build/r15-5460-ga4842917dcb8e6/arm-none-eabi/include/c++/15.0.0/utility:71,
                 from
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc:5:
/build/r15-5460-ga4842917dcb8e6/arm-none-eabi/include/c++/15.0.0/bits/stl_pair.h:871:9:
note: declared here
  871 |         pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
      |         ^~~~
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc:26:47:
warning: 'constexpr std::pair<_T1, _T2>::pair(_U1&&,
__zero_as_null_pointer_constant, ...) [with _U1 = MoveOnly; typename
std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >,
std::is_pointer<_T2>, std::is_constructible<_T1, _U1>,
std::__not_<std::is_constructible<_T1, const _U1&> >,
std::__not_<std::is_convertible<_U1, _T1> > >::value, bool>::type <anonymous> =
false; _T1 = ExplicitMoveOnly; _T2 = int*]' is deprecated: use 'nullptr'
instead of '0' to initialize std::pair of move-only type and pointer
[-Wdeprecated-declarations]
   26 | pair<ExplicitMoveOnly, int*> v15(MoveOnly{}, 0); // { dg-warning
"deprecated" }
      |                                               ^
/build/r15-5460-ga4842917dcb8e6/arm-none-eabi/include/c++/15.0.0/bits/stl_pair.h:845:9:
note: declared here
  845 |         pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
      |         ^~~~
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc:28:42:
warning: 'constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant,
_U2&&, ...) [with _U2 = MoveOnly; typename
std::enable_if<std::__and_<std::is_pointer<_Tp>,
std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>,
std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2,
_T2> >::value, bool>::type <anonymous> = true; _T1 = int*; _T2 = MoveOnly]' is
deprecated: use 'nullptr' instead of '0' to initialize std::pair of move-only
type and pointer [-Wdeprecated-declarations]
   28 | pair<int*, MoveOnly> v16 = {0, MoveOnly{}}; // { dg-warning
"deprecated" }
      |                                          ^
/build/r15-5460-ga4842917dcb8e6/arm-none-eabi/include/c++/15.0.0/bits/stl_pair.h:858:9:
note: declared here
  858 |         pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
      |         ^~~~
/build/gcc_src/libstdc++-v3/testsuite/20_util/pair/cons/99957.cc:29:42:
warning: 'constexpr std::pair<_T1, _T2>::pair(_U1&&,
__zero_as_null_pointer_constant, ...) [with _U1 = MoveOnly; typename
std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >,
std::is_pointer<_T2>, std::is_constructible<_T1, _U1>,
std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U1,
_T1> >::value, bool>::type <anonymous> = true; _T1 = MoveOnly; _T2 = int*]' is
deprecated: use 'nullptr' instead of '0' to initialize std::pair of move-only
type and pointer [-Wdeprecated-declarations]
   29 | pair<MoveOnly, int*> v17 = {MoveOnly{}, 0}; // { dg-warning
"deprecated" }
      |                                          ^
/build/r15-5460-ga4842917dcb8e6/arm-none-eabi/include/c++/15.0.0/bits/stl_pair.h:832:9:
note: declared here
  832 |         pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
      |         ^~~~


In commit r15-5461-g59fbdb3a871585 it's mentioned that redundant warnings are
omitted, but here, there are no warnings emitted at all. Is this a bug?
I'm not sure if "c++" is the right component, if not, please correct it.

Reply via email to