Skip to content

Conversation

@vinay-deshmukh
Copy link
Contributor

@vinay-deshmukh vinay-deshmukh commented Oct 3, 2025

Fixes #128661

Depends on #134330

(A large of chunk of this patch will not be a diff once #134330 is merged as most of this patch's code relies on that PR)

Summary:

  1. move_assign and move_alloc are skipped for the same reason as [libc++] Make <map> std::map constexpr as part of P3372R3 #134330
  2. erase_if is also skipped for g++-15 for the same reason

@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch from 1564aab to 4947760 Compare October 18, 2025 18:50
@github-actions
Copy link

github-actions bot commented Oct 18, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link

github-actions bot commented Oct 18, 2025

✅ With the latest revision this PR passed the Python code formatter.

Apply initial _LIBCPP_CONSTEXPR_SINCE_CXX26

Add feature test macro

one test to start with

start seeing constexpr failures for at.pass.cpp

 member call on object outside its lifetime is not allowed in a constant expression

Move past member call on object past it's lifetime

Add ctor to initialize __value_type and __tree_node_base, and the object of unique_ptr

construction works, at() fails due to throw_out_of_range

can't intentionally throw in constexpr

note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>>'

note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>>

ignore min_allocator tests for now

at.pass.cpp works in cpp26 for some reason

empty.verify.cpp passes

index_key_.pass.cpp constexpr fixed, but other failure

index_rv_key.pass.cpp constexpr fixed, but other failure

fix index_tuple.pass.cpp

fix: iterator.pass.cpp

fix max_size.pass.cpp

size.pass.cpp

alloc.pass.cpp

blocked on assign_initializer_list

compare.pass.cpp

Modify all tests to have TEST_CONSTEXPR_CXX26 and without

passing at: copy_assign.addressof.compile.pass.cpp

failing at copy_assign.pass.cpp only in constexpr

pass deduct.pass.cpp

fix map.cons/from_range.pass.cpp

fail at map.cons/move_alloc.pass.cpp

fail at map.cons/move_assign.pass.cpp

fix map.cons/move_noexcept.pass.cpp

pass map.erasure/erase_if.pass.cpp

 error: call to deleted constructor at map.modifiers/emplace.pass.cpp

pass map.modifiers/erase_iter.pass.cpp

pass map.modifiers/extract_iterator.pass.cpp

TODO: node-handle tests

pass map.modifiers/extract_key.pass.cpp

pass map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp

pass map.modifiers/insert_cv.pass.cpp

pass map.modifiers/insert_iter_cv.pass.cpp

pass map.modifiers/insert_iter_rv.pass.cpp

pass map.modifiers/insert_node_type.pass

pass map.modifiers/insert_node_type_hint.pass.cpp

pass map.modifiers/insert_or_assign.pass.cpp

pass map.modifiers/insert_rv.pass.cpp

pass map.modifiers/try.emplace.pass.cpp, fix typos

pass map.nonmember/compare.three_way.pass.cpp

pass map.nonmember/op_compare.pass.cpp

pass map.observers/key_comp.pass.cpp

pass map.observers/value_comp.pass.cpp

pass map.ops/contains.pass.cpp

pass map.ops/contains_transparent.pass.cpp

pass map.ops/count.pass.cpp

pass map.ops/count_transparent.pass.cpp

pass map.ops/equal_range_transparent.pass.cpp

pass map.special/member_swap.pass.cpp

pass map.value_compare/invoke.pass.cpp

pass map.value_compare/types.pass.cpp

cleanup

Pass compare.pass.cpp

pass incomplete_type.pass.cpp

error: call to deleted constructor of '__node_value_type' (aka 'std::__value_type<int, int>')

clang-format

Generate macro version correctly

fix unrelated CI failures

pass map.modifiers/emplace.pass.cpp

pass map.modifiers/emplace_hint.pass.cpp

at.pass.cpp passes again

iterator.pass.cpp passes

move_assign.pass.cpp constexpr fixed

move_alloc.pass.cpp constexpr fixed, other remains

copy_assign.pass.cpp constexpr fixed, other remains

erase_iter.pass.cpp

fix typo

map.ops pass

Partially fix assign_initializer_list.pass.cpp

Fix assign_initializer_list.pass.cpp

fix placement new to use std::addressof

fix copy_assign.pass.cpp

move alloc failure location

git-clang-format upstream/main

featuer test generation

<__type_traits/is_constant_evaluated.h>

__node_value_type

Use __libcpp_is_constant_evaluated, still at 7 failures

fix feature gen?

feature macros

? lang support

cf

restore pair to main

back at 7 failures due to min_allocator.h

cf?

insert_range.pass.cpp, empty passes, stuck at next

min_allocator to main

tree

clang format

fix CI?

try CI fix?

readability-identifier-naming

libcpp-hide-from-abi

cf

_Args not Args

map?

generic-cxx03

libcpp-hide-from-abi

cxx03

tmp

WIP???

constexpr test ID*

at.pass.cpp works

empty.pass.cpp

index_key.pass.cpp -> static_assert

error: static assertion failed due to requirement 'std::is_same<std::__tree_node<std::__value_type<CopyInsertable<1>, CopyInsertable<2>>, void *>, std::pair<const CopyInsertable<1>, CopyInsertable<2>>>::value': Only allowed to construct Up

iterator.pass.cpp

size.pass.cpp

map.cons/assign_initializer_list.pass.cpp

map.modifiers/emplace.pass.cpp

map.modifiers/emplace_hint.pass.cpp

map.modifiers/erase_key.pass.cpp

map.ops/count.pass.cpp

map.ops/equal_range.pass.cpp

map.ops/find.pass.cpp

map.ops/upper_bound.pass.cpp

clang-format

fix error

value_comp bad merge

_root cannot be redeclared

remove base and cast

copy_assign.pass.cpp

fails largely because of constexpr limit, because for  Container<int, MoveOnly> c, issues happen similar to move_alloc move_assign

use __node_traits::construct over placement new, copy_assing copy_alloc still pass

cf

note for failure

TODO

add constexpr cpp26

mistake

6 failures

something

clean

clean more

fix same_as allocate issues in index_rv_key

failures at move_alloc and move_assign

allocator for copy_assign

index_rv_key at it again

haxxx

Temporary solution for UB & restriction

copy_assign.pass.cpp

Finally only 2 tests fail

insert_key.pass.cpp

Move_alloc.pass.cpp fails

add docs

move_alloc and move_assign, fail in __insert_unique_from_orphaned_node, need to place the SFINAE there, not in __assign_value

kind of fixed it, almost

Fix for move_assign

almost a fix for move_assign.pass.cpp

insert_range_maps_sets.h, needs a lot of constexpr depth

add why sfinae

insert_and_emplace_allocator_requirements.pass.cpp passes

use the typedef

remove concepts, collapse unnecessary sfinae

some docs

breaks correctly

still correct failures with cleanup

more cleans

more clean

PR review comment

include __memory/construct_at

`Assertion `getConstructController()->isInAllocatorConstruct()' failed.`Revert "PR review comment"

This reverts commit 4fbb472.

Fails with:

```
  # .---command stderr------------
  # | t.tmp.exe: /home/runner/_work/llvm-project/llvm-project/libcxx/test/support/container_test_types.h:399: CopyInsertable<1>::CopyInsertable(const CopyInsertable<Dummy> &) [Dummy = 1]: Assertion `getConstructController()->isInAllocatorConstruct()' failed.
  # `-----------------------------
  # error: command failed with exit status: 250
```

one clean

cleanup for libcxx/test/support/container_test_types.h

clean back

clang-format

adjust constexpr steps arg

clean

Redundant check

Add ReleaseNotes

use allocator as template arg and allocator_traits, tests passed in cpp26

cf

hide from abi

Attempt fix for gcc-15 std=c++26

try

format and arm fix attempt'

cf

fix non-ascii

=default;

noop

abi

constexpr-dtor

WIP: gcc-15 failure investigation

fix the first failure with ptr_ is uninitialized

fix map

revert min_allocator default construction

_ptr is not initialized

use allocator as template arg and allocator_traits, tests passed in cpp26

remove UB using list

cf

doc-fix

Replace __value_ with __get_value() for __tree_node

miss typo

fix ctor for cpp03 buffer

cf

rename in map as well

cf

include

more?

hide from abi

terser

redundant launder

single branch

remove the & from buffer

remove _LIBCPP_STANDALONE_DEBUG

cf

disable test for g++-15

remove debugging attempts

Remove debugging attempt

Fix testing at runtime as well

Description and links

partial fix for }

restore TEST_HAS_NO_EXCEPTIONS

Remove extra include

remove set -x

undo debug attempts

Refactor libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp

CWG1514: key() is not constexpr

static can't be constexpr

Refactor libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp

Refactor libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp

Refactor libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp

Refactor libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp

Refactor libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp

grammar

Pass the generic-hardening-mode-debug

cf and remove non-ascii

Remove hide abi

obsolete comment

Add FIXME

Apply cf

cf

add constexpr

cf

Move ReleaseNotes to Implemented papers

Fix order of annotations

node-handle doc

unrelated defaulting

undo previous

unnecessary destructor for __tree_node_base

Remove constexpr from cpp03 code

Unnecessary annotation on deleted function

simplify type_trait

Allow runtime decision for __insert_unique_from_orphaned_node

Allow runtime decision for __assign_value

local cf

Simplify at.pass.cpp

use TEST_IS_CONSTANT_EVALUATED over libcxx function

Remove extra arm CI hack

missing space

Avoid creating a __tmp

explicit copy

Remove constexpr annotations from multimap

CI fix for clang <=20

Check clang<20 only for clang based compilers

Fix apple-clang macro lookup

Fixme, not todo

Updated FIXME

Remove assert(test());

clang-format?

Synopsis attach:  // constexpr since C++26

Revert "Remove assert(test());"

This reverts commit 9f931f5.

Fix the sed script
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch 2 times, most recently from e3dcddb to b64ebc0 Compare October 18, 2025 20:04
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch from b64ebc0 to 993c5f8 Compare October 18, 2025 20:04
…P3372-constexpr-multimap

# Conflicts:
#	libcxx/include/map
#	libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch 3 times, most recently from c9a47bb to 5ceecaa Compare November 8, 2025 20:52
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch from 5ceecaa to cecb182 Compare November 8, 2025 21:21
@vinay-deshmukh vinay-deshmukh force-pushed the vinay-issue-128661-P3372-constexpr-multimap branch from feec9a5 to 0c6222e Compare November 8, 2025 22:13
…bcxx-next-runners)

```
 # .---command stderr------------
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:307:17: error: static assertion expression is not an integral constant expression
  # |   307 |   static_assert(test());
  # |       |                 ^~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__iterator/wrap_iter.h:60:95: note: constexpr evaluation hit maximum step limit; possible infinite loop?
  # |    60 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { return *__i_; }
  # |       |                                                                                               ^
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__iterator/bounded_iter.h:123:12: note: in call to 'this->__current_.operator*()'
  # |   123 |     return *__current_;
  # |       |            ^~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__algorithm/remove.h:34:9: note: in call to '__first.operator*()'
  # |    34 |         *__first = std::move(*__i);
  # |       |         ^~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:51:16: note: in call to 'remove<std::__bounded_iter<std::__wrap_iter<void **>>, std::__tree_node<std::__value_type<int, int>, void *> *>({{&{*new void *[256]llvm#641}[34]}, {&{*new void *[256]llvm#641}[0]}, {&{*new void *[256]llvm#641}[256]}}, {{&{*new void *[256]llvm#641}[57]}, {&{*new void *[256]llvm#641}[0]}, {&{*new void *[256]llvm#641}[256]}}, ptr)'
  # |    51 |     auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
  # |       |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__memory/allocator_traits.h:289:5: note: in call to '__a.deallocate(&{*new std::__tree_node<std::__value_type<int, int>, void *>[1]llvm#554}[0], 1)'
  # |   289 |     __a.deallocate(__p, __n);
  # |       |     ^~~~~~~~~~~~~~~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__tree:1531:7: note: in call to 'deallocate(orig.__tree_.struct (anonymous struct at /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__tree:874:3).__node_alloc_, &{*new std::__tree_node<std::__value_type<int, int>, void *>[1]llvm#554}[0], 1)'
  # |  1531 |       __node_traits::deallocate(__alloc_, __ptr, 1);
  # |       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__tree:1533:7: note: (skipping 4 calls in backtrace; use -fconstexpr-backtrace-limit=0 to see all)
  # |  1533 |       (*this)(std::__static_fancy_pointer_cast<__node_pointer>(__right));
  # |       |       ^
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/generic-hardening-mode-fast-with-abi-breaks/libcxx/test-suite-install/include/c++/v1/__tree:955:5: note: in call to 'this->destroy(&{*new std::__tree_node<std::__value_type<int, int>, void *>[1]llvm#541}[0])'
  # |   955 |     destroy(__root());
  # |       |     ^~~~~~~~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:237:9: note: in call to 'orig.__tree_.~__tree()'
  # |   237 |     Map orig(rhs_alloc);
  # |       |         ^~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:237:9: note: in call to 'orig.~multimap()'
  # |   237 |     Map orig(rhs_alloc);
  # |       |         ^~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:281:5: note: in call to 'test_alloc<tracking_allocator<std::pair<const int, int>>, AssertEmpty>(lhs_allocs, rhs_allocs, {&lhs_allocs, &rhs_allocs})'
  # |   281 |     test_alloc<tracking_allocator<std::pair<const int, int> > >(
  # |       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # |   282 |         lhs_allocs, rhs_allocs, AssertEmpty(lhs_allocs, rhs_allocs));
  # |       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp:307:17: note: in call to 'test()'
  # |   307 |   static_assert(test());
  # |       |                 ^~~~~~
  # | 1 error generated.
  # `-----------------------------
  # error: command failed with exit status: 1
```
//===----------------------------------------------------------------------===//

// <map>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff should disappear once #134330 is merged...

(and only libcxx/test/std/containers/associative/multimap/ should remain)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[libc++] P3372R3: constexpr multimap

1 participant