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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Martin <simar...@gcc.gnu.org>:

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

commit r15-7209-gbee1910b891f897fcd1789d1dbd3937621354943
Author: Simon Martin <si...@nasilyan.com>
Date:   Sat Jan 25 18:09:23 2025 +0100

    c++: Reinstate check for uninitialized bases with c++ <= 17 [PR118239]

    We currently accept this code with c++ <= 17 even though it's invalid
    since the base is not initialized (we properly reject it with c++ >= 20)

    === cut here ===
    struct NoMut1 { int a, b; };
    struct NoMut3 : NoMut1 {
      constexpr NoMut3(int a, int b) {}
    };
    void mutable_subobjects() {
      constexpr NoMut3 nm3(1, 2);
    }
    === cut here ===

    This is a fallout of r0-118700-gc2b3ec18a494e3, that ignores all fields
    with DECL_ARTIFICIAL in cx_check_missing_mem_inits, including those that
    represent base classes, and need to be checked.

    This patch makes sure that we only skip fields that have DECL_ARTIFICIAL
    if they don't have DECL_FIELD_IS_BASE.

            PR c++/118239

    gcc/cp/ChangeLog:

            * constexpr.cc (cx_check_missing_mem_inits): Don't skip fields
            with DECL_FIELD_IS_BASE.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/constexpr-base8.C: New test.
  • [Bug c++/118239] [12/13/14/15 R... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to