[libcxx-commits] [PATCH] D97394: [libc++] [C++2b] [P2162] Allow inheritance from std::variant.

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 24 08:26:54 PST 2021


curdeius created this revision.
curdeius added a reviewer: ldionne.
Herald added a subscriber: arichardson.
curdeius requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This patch changes the variant even in pre-C++2b.
It should not break anything, only allow use cases that didn't work previously.
Previous standards didn't disallow this AFAIK.
But I'm OK to make this change C++2b-only.

That's pretty much a work in progress, but I'd like to have your input on the following:

- What else should be tested?
- Is there a way to avoid __as_variant? Should it be a goal?
- __as_variant is used in __visitation::__variant::__visit_alt, but I haven't used it in __visitation::__variant::__visit_alt_at. That's because it is used only in __visit_value_at, which in turn is always used on variant specializations (that's in comparison operators).

- https://wg21.link/P2162


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97394

Files:
  libcxx/docs/Cxx2bStatusPaperStatus.csv
  libcxx/docs/FeatureTestMacroTable.rst
  libcxx/include/variant
  libcxx/include/version
  libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
  libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
  libcxx/test/std/utilities/variant/variant.relops/relops.pass.cpp
  libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp
  libcxx/utils/generate_feature_test_macro_components.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97394.326106.patch
Type: text/x-patch
Size: 10752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210224/305a8025/attachment-0001.bin>


More information about the libcxx-commits mailing list