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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <[email protected]>:

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

commit r17-4086-ge36fef054c03112a4cd20a6ff0a3b3533c41f2b5
Author: Tomasz KamiÅski <[email protected]>
Date:   Thu Sep 10 11:20:45 2026 +0200

    libstdc++: Value-initialize _Hashtable_ebo_helper members [PR126949]

    The no_unique_address _Hashtable_ebo_helper members (that replaced base
    classes in r15-6273-g689d4abc0b836a), are initialized with {}. Since the
    _Hashtable_ebo_helper are aggregates, aggregate initialization is
performed.
    In particular such initialization is ill-formed, if any aggregate member
    has explicit default constructor, as they cannot be initialized from {}.
    This introduced an regression, where hasher, equality, and allocators with
    explicit default constructor were no longer supported.

    This patch addresses above by properly value-initializing such members,
    using = Type() syntax, which in turn value-initializes all aggregate
    members, and calls explicit default constructors.

    libstdc++-v3/ChangeLog:

            PR libstdc++/126949
            * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash)
            (_Hashtable_base::_M_equal, _Hashtable_alloc::_M_alloc):
            Value initialized members in NSDMI.
            * testsuite/23_containers/unordered_map/cons/default.cc: Check
            default construction with an hash, equality and allocator with
            explicit constructor.
            * testsuite/23_containers/unordered_set/cons/default.cc: Likewise.

    Reviewed-by: Jonathan Wakely <[email protected]>
    Co-authored-by: Marco Falke <[email protected]>
    Signed-off-by: Tomasz KamiÅski <[email protected]>

Reply via email to