PR c++/99251 - inconsistent -Wnonnull warning behaviour with dynamic_cast
authorMartin Sebor <msebor@redhat.com>
Tue, 2 Mar 2021 18:12:50 +0000 (11:12 -0700)
committerMartin Sebor <msebor@redhat.com>
Tue, 2 Mar 2021 18:12:50 +0000 (11:12 -0700)
commit66ecb059c9d77cfcfb06cbdc3cac6a63b9e67f3d
treeecb475f0a8a856dcd03e0b200c71257f9c1911e9
parent5a233ae4d8c978a3c863c8199d6c3050389a84d1
PR c++/99251 - inconsistent -Wnonnull warning behaviour with dynamic_cast

gcc/cp/ChangeLog:

PR c++/99251
* class.c (build_base_path): Call build_if_nonnull.
* cp-tree.h (build_if_nonnull): Declare.
* rtti.c (ifnonnull): Rename...
(build_if_nonnull): ...to this.  Set no-warning bit on COND_EXPR.
(build_dynamic_cast_1): Adjust to name change.

gcc/testsuite/ChangeLog:

PR c++/99251
* g++.dg/warn/Wnonnull9.C: Expect no warnings.
* g++.dg/warn/Wnonnull12.C: New test.
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/rtti.c
gcc/testsuite/g++.dg/warn/Wnonnull12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wnonnull9.C