From d1523f7a8c2247adfee559b127206a40ce4b2591 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 1 Jul 2019 19:59:34 +0000 Subject: Ensure bitset's string constructor doesn't poison the overload set. llvm-svn: 364842 --- .../template.bitset/bitset.cons/string_ctor.pass.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libcxx/test/std/utilities') diff --git a/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp index 453db91f29d..b08449ce8eb 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp @@ -74,6 +74,18 @@ void test_string_ctor() } } +struct Nonsense { + virtual ~Nonsense() {} +}; + +void test_for_non_eager_instantiation() { + // Ensure we don't accidentally instantiate `std::basic_string` + // since it may not be well formed and can cause an error in the + // non-immediate context. + static_assert(!std::is_constructible, Nonsense*>::value, ""); + static_assert(!std::is_constructible, Nonsense*, size_t, Nonsense&, Nonsense&>::value, ""); +} + int main(int, char**) { test_string_ctor<0>(); @@ -85,6 +97,7 @@ int main(int, char**) test_string_ctor<64>(); test_string_ctor<65>(); test_string_ctor<1000>(); + test_for_non_eager_instantiation(); return 0; } -- cgit v1.2.3