[libcxx-commits] [libcxx] [libc++] <algorithm>: __is_callable checks whether the callable can be called with rvalue (PR #73451)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 12:07:59 PST 2023


https://github.com/EricWF requested changes to this pull request.

I don't understand the motivation behind static asserts like this.  They have a number of downsides.

1.  They cost compile time and memory. The instantiations they perform live in the compilers AST until the end of the TU.
2. They don't catch broken code. The broken code is already broken, this just diagnoses it differently.
3.  They break well formed code.

As evidenced here, when we get the needless checks wrong, they break valid code. Which is a lot worse than providing a slightly better diagnostic to ill-formed code.

I say we get rid of them entirely. 

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


More information about the libcxx-commits mailing list