[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
Thu Mar 4 07:45:33 PST 2021

curdeius added inline comments.

Comment at: libcxx/test/std/utilities/variant/variant.visit/visit.pass.cpp:376
+  struct EvilVariant2 : std::variant<int, long>, std::type_info {};
Quuxplusone wrote:
> Would it be appropriate to also test the behavior of `struct X : std::variant<int>, std::variant<long> {}` and `struct Y : private std::variant<int> {}`? I don't think we expect either of those to support `std::visit`, but I wonder if they're supposed to SFINAE away cleanly or give some awful template error message or what.
I don't see how it may be SFINAE-friendly (but I haven't checked).

Comment at: libcxx/utils/generate_feature_test_macro_components.py:631
     "name": "__cpp_lib_variant",
-    "values": { "c++17": 201606 },
+    "values": { "c++17": 201606, "c++2b": 202102 },
     "headers": ["variant"],
Quuxplusone wrote:
> Since you're making the change in all language versions (IIUC), shouldn't the feature-test macro have the higher value in all language versions? (Has this situation ever come up in WG21 before? what did the Committee think vendors should do?)
Ha, good catch. No idea what should be done, probably always setting to the higher value is OK.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list