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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:a1c6e9631ca33990a2b7411060ca4d18db081a7d

commit r14-2146-ga1c6e9631ca33990a2b7411060ca4d18db081a7d
Author: Jason Merrill <ja...@redhat.com>
Date:   Sat Jun 24 05:15:02 2023 -0400

    c++: C++26 constexpr cast from void* [PR110344]

    P2768 allows static_cast from void* to ob* in constant evaluation if the
    pointer does in fact point to an object of the appropriate type.
    cxx_fold_indirect_ref already does the work of finding such an object if it
    happens to be a subobject rather than the outermost object at that address,
    as in constexpr-voidptr2.C.

            P2768
            PR c++/110344

    gcc/c-family/ChangeLog:

            * c-cppbuiltin.cc (c_cpp_builtins): Update __cpp_constexpr.

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_constant_expression): In C++26, allow cast
            from void* to the type of a pointed-to object.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp26/constexpr-voidptr1.C: New test.
            * g++.dg/cpp26/constexpr-voidptr2.C: New test.
            * g++.dg/cpp26/feat-cxx26.C: New test.

Reply via email to