[libcxx-commits] [PATCH] D106827: [libc++] Implement the resolution for LWG3522 in all language modes.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 26 14:12:20 PDT 2021
Quuxplusone added inline comments.
================
Comment at: libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_constraint.compile.pass.cpp:21
+static_assert( std::is_constructible<std::vector<int>, int, int>::value, "");
+static_assert(!std::is_constructible<std::priority_queue<int>, int, int>::value, "");
----------------
I had initially written this test as follows, to test SFINAE-friendliness; but during the rebase I temporarily forgot why I'd done that, and changed it to the much simpler (but not-testing-SFINAE) version you see above. If you want me to change back to the SFINAE version, I can.
```
template<class Seq>
std::true_type test(int, decltype(Seq(1,2))) { return {}; }
template<class Seq>
std::false_type test(long, Seq) { return {}; }
int main(int, char**)
{
// Sanity-check that std::vector<int>(1,2) is well-formed.
auto vector_is_constructible = test< std::vector<int> >(1, {});
static_assert(decltype(vector_is_constructible)::value, "");
// LWG3522: std::priority_queue<int>(1,2) is NOT well-formed.
auto pq_is_constructible = test< std::priority_queue<int> >(1, {});
static_assert(!decltype(pq_is_constructible)::value, "");
return 0;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106827/new/
https://reviews.llvm.org/D106827
More information about the libcxx-commits
mailing list