[libcxx-commits] [libcxx] [libc++] Simplify a bunch of noexcept specifications (PR #166397)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 17 08:28:16 PST 2025


https://github.com/ldionne commented:

I can only guess, but I suspect the reason for having written these conditional noexcepts this way could be the fact that Clang generates sub-optimal code when calling a non-noexcept function from a noexcept function. It basically generates a try-catch that calls `terminate` in the catch block.

Hence, it's technically possible that we'd start generating worse code when we have an allocator that doesn't throw but fails to be marked as `noexcept`. Arguably, we should fix Clang's strategy for handling this as discussed in https://discourse.llvm.org/t/rfc-add-call-unwindabort-to-llvm-ir.

Generally speaking LGTM but I'd like you to investigate the situation for move-assignment operators.

https://github.com/llvm/llvm-project/pull/166397


More information about the libcxx-commits mailing list