[libcxx-commits] [libcxx] [libc++][memory] Applied `[[nodiscard]]` to smart pointers (PR #168483)
Nico Weber via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 24 11:08:31 PST 2025
nico wrote:
Thanks for all the `[[nodiscard]]` patches! They find real bugs.
For `make_unique` in particular, I'll mention that in Chromium, this has been a false positive in 3 / 3 cases (https://chromium-review.googlesource.com/c/chromium/src/+/7199487). There's a 4th case that's only hit on some platforms that I haven't analyzed yet.
It's a pretty small N, so I don't suggest doing anything in response to this data point, but if other projects are seeing this too, maybe it might make sense to roll back the make_unique nodiscard. I can easily imagine it catching bugs. But maybe creating objects for side effects is common enough that it isn't worth it in total. (Or maybe it is! Just contributing a data point.)
https://github.com/llvm/llvm-project/pull/168483
More information about the libcxx-commits
mailing list