[all-commits] [llvm/llvm-project] 75f0ec: [libc++] remove duplicate assertions for void/refe...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Sun May 24 06:59:47 PDT 2026


  Branch: refs/heads/users/mizvekov/libcxx-redundant-anycast-assert
  Home:   https://github.com/llvm/llvm-project
  Commit: 75f0ec0e6045a8f7216b12e3377734192f977db9
      https://github.com/llvm/llvm-project/commit/75f0ec0e6045a8f7216b12e3377734192f977db9
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2026-05-24 (Sun, 24 May 2026)

  Changed paths:
    M libcxx/include/any
    A libcxx/test/std/utilities/any/any.nonmembers/any.cast/const_reference_types.verify.cpp
    M libcxx/test/std/utilities/any/any.nonmembers/any.cast/reference_types.verify.cpp
    A libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.const.verify.cpp
    M libcxx/test/std/utilities/any/any.nonmembers/any.cast/void.verify.cpp

  Log Message:
  -----------
  [libc++] remove duplicate assertions for void/reference const any_cast

For test cases of the const overload of any_cast, such as:
```C++
void test() {
  std::any a = 0;
  const std::any& a2 = a;
  (void)std::any_cast<int&>(&a2);
}
```
(And similarly for void).

The problem is that the assertions are implemented both in the const and non-const any_cast overloads,
but since the const overload delegates to the non-const overload, that ends up producing the same assertion twice.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list