A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/CWG/issues/2514.html below:

CWG Issue 2514

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-08-11

2514. Modifying const subobjectsSection: 6.8.4  [basic.life]     Status: open     Submitter: Jiang An     Date: 2021-11-07     Liaison: SG12

The change in C++20 for RU007 allows transparently replacing a const subobject whose complete object is not const, and the new object can be non-const. However, if the reuse of the object has not happened, modifying such subobjects is still undefined behavior.

This restriction causes problems in the implementation of std::map and std::unordered_map; see this bug report. Here, the key_type objects in map containers are const, and implementations generally can't replace these objects after construction.

Perhaps these restrictions can be relaxed to assist in this case: if

a const subobject could be modified.

(Is it meaningful to allow a new-expression like new const int(42) to create cv-qualified objects? Perhaps such objects should be unqualified, while maintaining the cv-qualification in the type of the expression?)

Notes from the November, 2022 meeting

The advice of SG12 is solicited; see cplusplus/papers#1395.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4