]> gcc.gnu.org Git - gcc.git/commit
c++: Fix pretty-print of pointer minus integer.
authorJason Merrill <jason@redhat.com>
Thu, 4 Jun 2020 19:56:57 +0000 (15:56 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 5 Jun 2020 17:54:54 +0000 (13:54 -0400)
commit5094c4400a8687dcf44f5993aee3a88e98519f3b
treee55070d15ade1137ed75162bab35f98e04a91825
parent640e05e02b567fa5ccf4c207e6fc6c3e9a93b17c
c++: Fix pretty-print of pointer minus integer.

For whatever reason, GCC internally represents a pointer minus an integer as
a pointer plus a very large unsigned integer.  But exposing that to users is
unsightly, and it's easy enough to show the real value.

gcc/cp/ChangeLog:

* error.c (dump_binary_op): Handle negative operand to
POINTER_PLUS_EXPR.

gcc/c-family/ChangeLog:

* c-pretty-print.c (pp_c_additive_expression): Handle negative
operand to POINTER_PLUS_EXPR.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-ptrsub2.C: New test.
gcc/c-family/c-pretty-print.c
gcc/cp/error.c
gcc/testsuite/g++.dg/cpp0x/constexpr-ptrsub2.C [new file with mode: 0644]
This page took 0.06307 seconds and 6 git commands to generate.