Skip to content

Conversation

@AlexGuteniev
Copy link
Contributor

@AlexGuteniev AlexGuteniev commented Nov 29, 2025

Towards #5504.
Follow up on #5808.

📦 Newly unwrapped cases

  • move_only_function<R(Args...) cv1-ref1-noex1>(move_only_function<R(Args...) cv2-ref2-noex2>(callable)); where noexcept and const may be present in only inner, and & or && may be present in only outer
  • move_only_function<R(Args...) cv-ref>(function<R(Args...)>(callable)) where cv-ref can have const, &, and &&.

In the tests make sure the type system is not broken, and the cases which are not supposed to compile, still do not compile.

🐿️ Squirrelly case

Inner noexcept, outer non-noexcept case is squirrelly.

If we keep conditional noexcept on the structure, it would violate strict aliasing: the inner one would have a different _Function_base and thus _Function_base::_Impl_t.

Alternatives:

  • To fix that, we remove _Noexcept parameter from _Function_base, and pass that as template parameter on function construction, also dress it onto _Invoke pointer with reinterpret_cast when needed. This is doable, but makes the current change more complicated.
  • Not have noexcept varying case unwrapped.
  • Not use noexcept function pointer (bad, missed optimization we're asked to do).
  • Have completely untyped _Impl_t (need to get that working in clang-cl somehow, as it can't assign function pointer to void*)

@StephanTLavavej StephanTLavavej added enhancement Something can be improved performance Must go faster and removed enhancement Something can be improved labels Nov 29, 2025
@AlexGuteniev AlexGuteniev marked this pull request as draft December 1, 2025 14:33
@AlexGuteniev AlexGuteniev marked this pull request as ready for review December 1, 2025 18:39
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Must go faster

Projects

Status: Ready To Merge

Development

Successfully merging this pull request may close these issues.

2 participants