[Bug c++/118775] [13 Regression] ICE in tree_to_uhwi with unique_ptr and addresss of var converted to an integer

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118775

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Marek Polacek
<[email protected]>:

https://gcc.gnu.org/g:064b4be33abf46ce6944277969e77a8bc5a97202

commit r13-10475-g064b4be33abf46ce6944277969e77a8bc5a97202
Author: Marek Polacek <[email protected]>
Date:   Thu Aug 20 15:01:37 2026 -0400

    c++: ICE with operator new[] in constexpr [PR118775]

    Here we ICE since r11-7740 because we no longer say that (long)&a
    (where a is a global var) is non_constant_p.  So VERIFY_CONSTANT
    does not return and we crash on tree_to_uhwi.  We should check
    tree_fits_uhwi_p before calling tree_to_uhwi.

            PR c++/118775

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_call_expression): Check tree_fits_uhwi_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/constexpr-new24.C: New test.
            * g++.dg/cpp2a/constexpr-new25.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit aa55a6a30bc4778938af42dac9b624cf67fa4698)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.