[libcxx-commits] [libcxx] [libc++][NFC] Remove `optional::__get` (PR #217218)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 20 02:53:56 PDT 2026


frederick-vs-ja wrote:

> If we really want to avoid ADL we can also use `value()` instead, which I think is much more canonical than `.operator*()`. However, I'm not really care here?

I think it's fine to use `value()` at this moment. Although I'm not sure in the future, whether we will provide a mode where `value()` functions are deleted (as suggested by the `// freestanding-deleted` comments).

If we use `*opt` which causes ADL, the changes are no longer NFC as it would become possible for users to hijack the behavior of `optional` construction/assignment, and some operations would stop working for ADL-unfriendly types (e.g., `Holder<Incomplete>*` in [P2538R1](https://wg21.link/p2538r1)).

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


More information about the libcxx-commits mailing list