https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103700
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:88cdcb5c18d73bfc9960d774c678f0e8103b8031 commit r12-6123-g88cdcb5c18d73bfc9960d774c678f0e8103b8031 Author: Patrick Palka <ppa...@redhat.com> Date: Mon Dec 27 09:05:17 2021 -0500 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.