https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126599
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:0ffbcec62de9419812ef0017d74ce20572586c6c commit r17-4594-g0ffbcec62de9419812ef0017d74ce20572586c6c Author: Jakub Jelinek <[email protected]> Date: Wed Sep 23 09:22:07 2026 +0200 c++: Improve printing of null pointer to data member constants [PR126599] For null pointer to data member we use INTEGER_CST with OFFSET_TYPE and -1 value. When that is printed in diagnostics or in display_string_of, it is printed as -1, which is confusing to users and an implementation detail (well, part of ABI https://itanium-cxx-abi.github.io/cxx-abi/abi.html#data-member-pointers A null data member pointer is represented as an offset of -1. ). Now, as the first testcase shows, if we have a non-null pointer to data member constant, it is actually PTRMEM_CST and is printed in a user-friendly way, the following patch just arranges to print the OFFSET_TYPE -1 INTEGER_CST similarly. 2026-09-23 Jakub Jelinek <[email protected]> PR c++/126599 * error.cc (dump_expr): Print OFFSET_TYPE -1 differently. * g++.dg/diagnostic/ptrtomem5.C: New test. * g++.dg/diagnostic/ptrtomem6.C: New test. * g++.dg/reflect/display_string_of1.C: Add 2 new tests. * g++.dg/reflect/u8display_string_of1.C: Likewise. Reviewed-by: Jason Merrill <[email protected]>
