https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86738
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Wed Sep 5 07:19:27 2018 New Revision: 264104 URL: https://gcc.gnu.org/viewcvs?rev=264104&root=gcc&view=rev Log: Backported from mainline 2018-08-08 Jakub Jelinek <ja...@redhat.com> PR c++/86738 * constexpr.c (cxx_eval_binary_expression): For arithmetics involving NULL pointer set *non_constant_p to true. (cxx_eval_component_reference): For dereferencing of a NULL pointer, set *non_constant_p to true and return t. * g++.dg/opt/pr86738.C: New test. Added: branches/gcc-8-branch/gcc/testsuite/g++.dg/opt/pr86738.C Modified: branches/gcc-8-branch/gcc/cp/ChangeLog branches/gcc-8-branch/gcc/cp/constexpr.c branches/gcc-8-branch/gcc/testsuite/ChangeLog