[libcxx-commits] [PATCH] D109066: [libc++] Implement P1951, default arguments for pair's forwarding constructor

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 1 10:02:15 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp:126
+    }
+#endif
+
----------------
I'd like to see some tests for:
- SFINAE-friendliness. `template<class T> void foo() -> decltype(std::pair<T, T>({}, {}))` I guess should be SFINAE-friendly.
- CTAD, even though AIUI the class template arguments will never be deducible. Still, I guess `void foo(auto t) -> decltype(std::pair({}, t))` should be SFINAE-friendly.
- Both brace-init and parens-init: `std::pair<T, U>({}, {})` and `std::pair<T, U>{{}, {}}`.
- SFINAE-friendliness of something like this, i.e. we didn't mess up the conditional-explicit-ness of the constructors involved. (I may not have thought this one out sufficiently. pair's constructor overload set is //very// confusing.)
```
struct ExplicitBraceT { explicit ExplicitBraceT(); };
void f(std::pair<ExplicitBraceT, ExplicitBraceT>);  // #1
void f(std::pair<BraceInit, BraceInit>);  // #2
int main() { f({{}, {}}); }  // unambiguously calls #2, right?
```


Btw, there's precedent for this kind of "in standards greater than X, //or// `_LIBCPP_VERSION`" test, here: `libcxx/test/std/utilities/utility/forward/{move,forward}.pass.cpp`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109066/new/

https://reviews.llvm.org/D109066



More information about the libcxx-commits mailing list