[clang] [Sema] Permit side-effect-free function calls in C++23 [[assume]] (PR #194243)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 27 06:45:26 PDT 2026


https://github.com/AaronBallman commented:

I'm not convinced we should go this route. It's not that the intent is incorrect, but this adds compile time overhead to check assumptions and that overhead can be of arbitrary complexity so long as function bodies are within the TU. It's also a bit of a slippery slope; the next logical step for these changes is to introduce a control flow graph so that we can skip false positives in statically unreachable code. But given that we are following call chains where we can see the function bodies anyway, I suspect we'd also see requests for data flow analysis to further reduce false positives, etc.

Being conservative the way Clang has been doing avoids that overhead and provides good safety guarantees.

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


More information about the cfe-commits mailing list