https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93633

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:81958cd6adf402a85dc7d21b43caac56fba0af21

commit r10-6533-g81958cd6adf402a85dc7d21b43caac56fba0af21
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sun Feb 9 12:32:22 2020 +0100

    c++: Fix ICE during constexpr virtual call evaluation [PR93633]

    The first (valid) testcase ICEs because for
      A *a = new B ();
      a->foo (); // virtual method call
    we actually see &heap  and the "heap " objects don't have the class or
    whatever else type was used in new expression, but an array type containing
    one (or more of those for array new) and so when using TYPE_BINFO (objtype)
    on it we ICE.
    This patch handles this special case, and otherwise punts (as shown e.g. in
    the second testcase, where because the heap object is already deleted,
    we don't really want to allow it to be used.

    2020-02-09  Jakub Jelinek  <ja...@redhat.com>

        PR c++/93633
        * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
        ARRAY_TYPE, use the element type.  Punt if objtype after that is not
        a class type.

        * g++.dg/cpp2a/constexpr-new11.C: New test.
        * g++.dg/cpp2a/constexpr-new12.C: New test.
        * g++.dg/cpp2a/constexpr-new13.C: New test.

Reply via email to