c++: hard error w/ ptr+N and incomplete type [PR103700]
authorPatrick Palka <ppalka@redhat.com>
Mon, 27 Dec 2021 14:05:17 +0000 (09:05 -0500)
committerPatrick Palka <ppalka@redhat.com>
Mon, 27 Dec 2021 14:05:17 +0000 (09:05 -0500)
commit88cdcb5c18d73bfc9960d774c678f0e8103b8031
treeda511aa68bded7934886558d1f1f3297ffa0b5fd
parent9407058a430316db5299bc7867e4a31f900cd197
c++: hard error w/ ptr+N and incomplete type [PR103700]

In pointer_int_sum when called from a SFINAE context, we need to avoid
calling size_in_bytes_loc on an incomplete pointed-to type since this
latter function isn't SFINAE-enabled and always emits an error on such
input.

PR c++/103700

gcc/c-family/ChangeLog:

* c-common.c (pointer_int_sum): When quiet, return
error_mark_node for an incomplete pointed-to type and don't
call size_in_bytes_loc.

gcc/testsuite/ChangeLog:

* g++.dg/template/sfinae32.C: New test.
gcc/c-family/c-common.c
gcc/testsuite/g++.dg/template/sfinae32.C [new file with mode: 0644]