Fix unused parameters and variables

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-12-23 23:37:52 +00:00
parent 17a98d8a92
commit 0e5ebbc77c
120 changed files with 307 additions and 268 deletions

View File

@@ -28,4 +28,5 @@ int main()
C::iterator i = c.end();
T j = *i;
assert(false);
((void)j);
}

View File

@@ -31,5 +31,5 @@ int main()
assert(myconv.converted() == 4);
// move construct a new converter and make sure the state is the same.
Myconv myconv2(std::move(myconv));
assert(myconv2.converted() == 4);
assert(myconv2.converted() == old_converted);
}

View File

@@ -23,11 +23,10 @@
#include <cmath>
constexpr bool a = std::__libcpp_isnan(0.);
constexpr bool b = std::__libcpp_isinf(0.0);
constexpr bool c = std::__libcpp_isfinite(0.0);
static_assert(std::__libcpp_isnan(0.) == false, "");
static_assert(std::__libcpp_isinf(0.0) == false, "");
static_assert(std::__libcpp_isfinite(0.0) == true, "");
int main()
{
return 0;
}

View File

@@ -18,5 +18,7 @@
int main()
{
std::complex<double> cd;
((void)cd);
double x = std::sin(0);
((void)x);
}

View File

@@ -659,11 +659,11 @@ class Configuration(object):
# These warnings should be enabled in order to support the MSVC
# team using the test suite; They enable the warnings below and
# expect the test suite to be clean.
# FIXME: Re-enable this after fixing remaining occurrences.
self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
self.cxx.addWarningFlagIfSupported('-Wunused-variable')
self.cxx.addWarningFlagIfSupported('-Wunused-parameter')
# FIXME: Enable the two warnings below.
self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
self.cxx.addWarningFlagIfSupported('-Wno-conversion')
# TODO(EricWF) Remove the unused warnings once the test suite
# compiles clean with them.
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')

View File

@@ -266,6 +266,7 @@ void test_derived_from_ref_wrap() {
auto& ret2 = std::__invoke(get_fn, d);
auto& cret2 = std::__invoke_constexpr(get_fn, d);
assert(&ret2 == &x);
assert(&cret2 == &x);
auto& ret3 = std::__invoke(get_fn, r2);
assert(&ret3 == &x);
}
@@ -367,4 +368,4 @@ int main() {
test_derived_from_ref_wrap();
#endif
}
}

View File

@@ -21,4 +21,5 @@ int main()
typedef std::unordered_multimap<int, int> M2;
M2::iterator i;
M1::iterator j = i;
((void)j);
}

View File

@@ -47,7 +47,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 5);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;
@@ -93,7 +96,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 5);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;

View File

@@ -45,7 +45,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 5);
assert(c.count(1) == 2);
assert(c.count(2) == 1);
@@ -68,7 +72,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 5);
assert(c.count(1) == 2);
assert(c.count(2) == 1);

View File

@@ -21,4 +21,5 @@ int main()
typedef std::unordered_multiset<int> M2;
M2::iterator i;
M1::iterator j = i;
((void)j);
}

View File

@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <unordered_set>
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
@@ -29,23 +31,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_allocator<int>
> C;
typedef int P;
P a[] =
{
P(1),
P(2),
P(3),
P(4),
P(1),
P(2)
};
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -105,23 +96,12 @@ int main()
assert(c0.empty());
}
#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
min_allocator<int>
> C;
typedef int P;
P a[] =
{
P(1),
P(2),
P(3),
P(4),
P(1),
P(2)
};
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -181,7 +161,6 @@ int main()
assert(c0.empty());
}
#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_multiset<int> s1 = {1, 2, 3};
@@ -193,5 +172,4 @@ int main()
assert(s2.size() == 2);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -45,7 +45,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 3);
assert(c.count(1) == 1);
assert(c.count(3) == 1);
@@ -66,7 +70,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
C::const_iterator i_next = i;
++i_next;
C::iterator j = c.erase(i);
assert(j == i_next);
assert(c.size() == 3);
assert(c.count(1) == 1);
assert(c.count(3) == 1);

View File

@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <unordered_set>
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
@@ -29,23 +31,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_allocator<int>
> C;
typedef int P;
P a[] =
{
P(1),
P(2),
P(3),
P(4),
P(1),
P(2)
};
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -105,23 +96,12 @@ int main()
assert(c0.empty());
}
#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
min_allocator<int>
> C;
typedef int P;
P a[] =
{
P(1),
P(2),
P(3),
P(4),
P(1),
P(2)
};
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -181,7 +161,6 @@ int main()
assert(c0.empty());
}
#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_set<int> s1 = {1, 2, 3};
@@ -193,5 +172,4 @@ int main()
assert(s2.size() == 2);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@@ -98,6 +98,8 @@ void checkThrows(any& a)
} catch (...) {
assert(false);
}
#else
((void)a);
#endif
}
@@ -176,7 +178,6 @@ void test_cast_to_value() {
Type::reset();
{
any a((Type(42)));
any const& ca = a;
assert(Type::count == 1);
assert(Type::copied == 0);
assert(Type::moved == 1);

View File

@@ -40,7 +40,6 @@ void doIOTest() {
using namespace fs;
using Ptr = const CharT*;
using StrStream = std::basic_stringstream<CharT>;
const char* const InCStr = InStr;
const Ptr E = OutStr;
const path p((const char*)InStr);
StrStream ss;

View File

@@ -60,6 +60,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)t); ((void)ec);
return true;
#endif
};

View File

@@ -62,6 +62,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)t); ((void)ec);
return true;
#endif
};
@@ -138,7 +139,6 @@ TEST_CASE(test_attributes_get_copied)
const path file = env.create_file("file1", 42);
const path dest = env.make_env_path("file2");
auto st = status(file);
perms default_perms = st.permissions();
perms new_perms = perms::owner_read;
permissions(file, new_perms);
std::error_code ec;

View File

@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)t); ((void)ec);
return true;
#endif
};

View File

@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
{
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
fs::create_directory_symlink(f, t);
return true;
} catch (filesystem_error const& err) {
return err.path1() == f
&& err.code() == ec;
}
#else
return true;
#endif
};
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);

View File

@@ -36,21 +36,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
{
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
fs::create_hard_link(f, t);
return true;
} catch (filesystem_error const& err) {
return err.path1() == f
&& err.code() == ec;
}
#else
return true;
#endif
};
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);

View File

@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
{
#ifndef TEST_HAS_NO_EXCEPTIONS
try {
fs::create_symlink(f, t);
return true;
} catch (filesystem_error const& err) {
return err.path1() == f
&& err.code() == ec;
}
#else
return true;
#endif
};
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);

View File

@@ -53,6 +53,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)opts); ((void)ec);
return true;
#endif
};
@@ -116,7 +117,7 @@ TEST_CASE(basic_permissions_test)
permissions(TC.p, TC.set_perms, ec);
TEST_CHECK(!ec);
auto pp = status(TC.p).permissions();
TEST_CHECK(status(TC.p).permissions() == TC.expected);
TEST_CHECK(pp == TC.expected);
}
}

View File

@@ -51,6 +51,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)ec);
return true;
#endif
};

View File

@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)ec);
return true;
#endif
};

View File

@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)ec);
return true;
#endif
};

View File

@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)t); ((void)ec);
return true;
#endif
};

View File

@@ -52,6 +52,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)s); ((void)ec);
return true;
#endif
};

View File

@@ -57,6 +57,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
((void)f); ((void)ec);
return true;
#endif
};

View File

@@ -43,7 +43,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};

View File

@@ -54,10 +54,12 @@ unsigned count_equal::count = 0;
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
count_equal::count = 0;
std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
assert(count_equal::count <= max_count);
assert(result == std::experimental::search(b1, e1, s));
}
@@ -78,7 +80,10 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa * 2);
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -93,6 +98,7 @@ test()
const unsigned sh = sizeof(ih)/sizeof(ih[0]);
int ii[] = {1, 1, 2};
do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
}
template <class Iter1, class Iter2>
@@ -112,7 +118,10 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa * 2);
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};

View File

@@ -54,7 +54,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
// assert(count_equal::count <= max_count);
assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -74,7 +74,10 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa * 2);
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -108,7 +111,8 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa*2);
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};

View File

@@ -42,7 +42,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_horspool_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};

View File

@@ -57,7 +57,9 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -77,7 +79,8 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa*2);
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -111,7 +114,8 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa*2);
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};

View File

@@ -53,7 +53,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
// assert(count_equal::count <= max_count);
assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -73,7 +73,8 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa*2);
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -107,7 +108,8 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
// FIXME: The max_count for this search should be 'sa'
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa*2);
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};

View File

@@ -44,7 +44,7 @@ constexpr bool test0(Input1 in1, Input2 in2, Output out)
template <typename Input1, typename Input2 = Input1>
constexpr bool do_test(int dummy = 0)
constexpr bool do_test(int = 0)
{
using S1 = typename std::make_signed<Input1>::type;
using S2 = typename std::make_signed<Input2>::type;

View File

@@ -43,7 +43,7 @@ constexpr bool test0(Input1 in1, Input2 in2, Output out)
template <typename Input1, typename Input2 = Input1>
constexpr bool do_test(int dummy = 0)
constexpr bool do_test(int = 0)
{
using S1 = typename std::make_signed<Input1>::type;
using S2 = typename std::make_signed<Input2>::type;

View File

@@ -55,7 +55,7 @@ public:
class Z
{
public:
Z(int i) {TEST_THROW(6);}
Z(int) {TEST_THROW(6);}
};

View File

@@ -60,7 +60,7 @@ public:
Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
friend void swap(Z& x, Z& y) {TEST_THROW(6);}
friend void swap(Z&, Z&) {TEST_THROW(6);}
};
struct ConstSwappable {

View File

@@ -59,7 +59,7 @@ public:
Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
friend void swap(Z& x, Z& y) {TEST_THROW(6);}
friend void swap(Z&, Z&) {TEST_THROW(6);}
};
int main()

View File

@@ -27,6 +27,7 @@ void test1 ( std::experimental::basic_string_view<CharT> sv, size_t n, size_t po
try {
std::experimental::basic_string_view<CharT> sv1 = sv.substr(pos, n);
assert(false);
((void)sv1);
} catch (const std::out_of_range&) {
return;
} catch (...) {

View File

@@ -25,4 +25,5 @@ int main() {
P p1(2);
P p2(std::move(p1));
assert(*p2 == 2);
}

View File

@@ -24,7 +24,7 @@ template <> struct hash<X>
{
typedef X first_argument_type;
size_t operator()(const first_argument_type& x1) const
size_t operator()(const first_argument_type&) const
{
return 99;
}

View File

@@ -18,4 +18,5 @@
int main()
{
std::ratio<100> x;
((void)x);
}

View File

@@ -13,5 +13,6 @@
int main()
{
std::experimental::erased_type e;
std::experimental::erased_type e;
((void)e);
}

View File

@@ -168,9 +168,6 @@ int main()
catch (std::ios_base::failure&)
{
}
#else
ios1.copyfmt(ios2);
#endif
assert(ios1.rdstate() == std::ios::eofbit);
assert(ios1.rdbuf() == &sb1);
assert(ios1.flags() == (std::ios::showpoint | std::ios::uppercase));
@@ -193,4 +190,5 @@ int main()
assert(ios1.pword(1) == &d2);
assert(ios1.tie() == (std::ostream*)2);
assert(ios1.fill() == '2');
#endif
}

View File

@@ -23,4 +23,5 @@ int main()
std::ostream_iterator<int> i(outf);
std::ostream_iterator<int> j = i;
assert(outf.good());
((void)j);
}

View File

@@ -48,7 +48,7 @@ void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
std::free(p);
}
void operator delete [] (void* p, std::align_val_t a) TEST_NOEXCEPT
void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT
{
++aligned_delete_called;
std::free(p);

View File

@@ -55,7 +55,7 @@ void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad
return DummyData;
}
void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT
void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT
{
assert(new_called == 1);
--new_called;

View File

@@ -49,7 +49,7 @@ void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
std::free(p);
}
void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT
{
++aligned_delete_called;
std::free(p);

View File

@@ -55,7 +55,7 @@ void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_a
return DummyData;
}
void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT
{
assert(new_called == 1);
--new_called;

View File

@@ -27,7 +27,6 @@
int main()
{
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
static_assert((std::is_base_of<std::locale::facet, F>::value), "");
static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
@@ -38,5 +37,5 @@ int main()
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
(void)F::id;
//#endif
((void)f);
}

View File

@@ -27,7 +27,6 @@
int main()
{
//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
static_assert((std::is_base_of<std::locale::facet, F>::value), "");
static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
@@ -38,5 +37,5 @@ int main()
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
(void)F::id;
//#endif
((void)f);
}

View File

@@ -24,5 +24,6 @@ int main()
{
B b;
std::mbstate_t s = b.state();
((void)s);
}
}

View File

@@ -22,4 +22,5 @@ int main()
typedef std::wstring_convert<Codecvt> Myconv;
Myconv myconv;
std::mbstate_t s = myconv.state();
((void)s);
}

View File

@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -34,7 +34,6 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -36,7 +36,6 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -36,7 +36,6 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -36,7 +36,6 @@ test()
void test_edges()
{
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -36,7 +36,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{

View File

@@ -45,7 +45,6 @@ int main()
// Test return value of assignment.
{
int a1[] = {0, 1, 2};
int a2[] = {3, 4, 3};
std::valarray<int> v1(a1, 3);
std::slice_array<int> s1 = v1[std::slice(1, 1, 1)];
std::slice_array<int> s2 = v1[std::slice(0, 1, 1)];

View File

@@ -41,7 +41,6 @@ int main()
typedef int T;
T a1[] = {1, 2, 3, 4, 5};
const unsigned N1 = sizeof(a1)/sizeof(a1[0]);
const unsigned N2 = 0;
std::valarray<T> v1(a1, N1);
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
@@ -57,7 +56,6 @@ int main()
{
typedef int T;
T a2[] = {6, 7, 8, 9, 10, 11, 12};
const unsigned N1 = 0;
const unsigned N2 = sizeof(a2)/sizeof(a2[0]);
std::valarray<T> v1;
std::valarray<T> v2(a2, N2);
@@ -73,8 +71,6 @@ int main()
}
{
typedef int T;
const unsigned N1 = 0;
const unsigned N2 = 0;
std::valarray<T> v1;
std::valarray<T> v2;
std::valarray<T> v1_save = v1;

View File

@@ -43,7 +43,6 @@ int main()
typedef int T;
T a1[] = {1, 2, 3, 4, 5};
const unsigned N1 = sizeof(a1)/sizeof(a1[0]);
const unsigned N2 = 0;
std::valarray<T> v1(a1, N1);
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
@@ -59,7 +58,6 @@ int main()
{
typedef int T;
T a2[] = {6, 7, 8, 9, 10, 11, 12};
const unsigned N1 = 0;
const unsigned N2 = sizeof(a2)/sizeof(a2[0]);
std::valarray<T> v1;
std::valarray<T> v2(a2, N2);
@@ -75,8 +73,6 @@ int main()
}
{
typedef int T;
const unsigned N1 = 0;
const unsigned N2 = 0;
std::valarray<T> v1;
std::valarray<T> v2;
std::valarray<T> v1_save = v1;

View File

@@ -44,7 +44,7 @@ constexpr bool test0(Input1 in1, Input2 in2, Output out)
template <typename Input1, typename Input2 = Input1>
constexpr bool do_test(int dummy = 0)
constexpr bool do_test(int = 0)
{
using S1 = typename std::make_signed<Input1>::type;
using S2 = typename std::make_signed<Input2>::type;

View File

@@ -43,7 +43,7 @@ constexpr bool test0(Input1 in1, Input2 in2, Output out)
template <typename Input1, typename Input2 = Input1>
constexpr bool do_test(int dummy = 0)
constexpr bool do_test(int = 0)
{
using S1 = typename std::make_signed<Input1>::type;
using S2 = typename std::make_signed<Input2>::type;

View File

@@ -49,6 +49,8 @@ void check_random_device_invalid(const std::string &token) {
LIBCPP_ASSERT(false);
} catch (const std::system_error&) {
}
#else
((void)token);
#endif
}

View File

@@ -187,7 +187,7 @@ test4()
kurtosis += d2 * d2;
}
var /= u.size();
double dev = std::sqrt(var);
//double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -236,7 +236,7 @@ test5()
kurtosis += d2 * d2;
}
var /= u.size();
double dev = std::sqrt(var);
// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -389,7 +389,7 @@ test9()
kurtosis += d2 * d2;
}
var /= u.size();
double dev = std::sqrt(var);
// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -438,7 +438,7 @@ test10()
kurtosis += d2 * d2;
}
var /= u.size();
double dev = std::sqrt(var);
// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -487,7 +487,7 @@ test11()
kurtosis += d2 * d2;
}
var /= u.size();
double dev = std::sqrt(var);
// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan

View File

@@ -193,8 +193,8 @@ test4()
kurtosis -= 3;
double x_mean = d.k() * (1 - d.p()) / d.p();
double x_var = x_mean / d.p();
double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
// double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
// double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
assert(mean == x_mean);
assert(var == x_var);
}

View File

@@ -617,11 +617,12 @@ int main()
}
std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
*/ {
/*
std::cmatch m;
const char s[] = "m";
/* assert(std::regex_match(s, m,*/ std::regex("[a[=M=]z]"/*,
std::regex_constants::awk*/);//));
/* assert(m.size() == 1);
assert(std::regex_match(s, m, std::regex("[a[=M=]z]",
std::regex_constants::awk);
assert(m.size() == 1);
assert(!m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);

View File

@@ -37,6 +37,8 @@ extern "C" void LLVMFuzzerTestOneInput(const char *data)
}
catch (std::regex_error &) {}
}
#else
((void)data);
#endif
}

View File

@@ -18,7 +18,6 @@
int main()
{
char s1[] = {1, 2, 3};
char s2[3] = {0};
assert(std::char_traits<char>::assign(s2, 3, char(5)) == s2);
assert(s2[0] == char(5));

View File

@@ -19,7 +19,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
char16_t s1[] = {1, 2, 3};
char16_t s2[3] = {0};
assert(std::char_traits<char16_t>::assign(s2, 3, char16_t(5)) == s2);
assert(s2[0] == char16_t(5));

View File

@@ -19,7 +19,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
char32_t s1[] = {1, 2, 3};
char32_t s2[3] = {0};
assert(std::char_traits<char32_t>::assign(s2, 3, char32_t(5)) == s2);
assert(s2[0] == char32_t(5));

View File

@@ -18,7 +18,6 @@
int main()
{
wchar_t s1[] = {1, 2, 3};
wchar_t s2[3] = {0};
assert(std::char_traits<wchar_t>::assign(s2, 3, wchar_t(5)) == s2);
assert(s2[0] == wchar_t(5));

View File

@@ -72,7 +72,7 @@ std::unique_ptr<int> f4(std::unique_ptr<int>&& p)
void f5(int j)
{
std::this_thread::sleep_for(ms(200));
TEST_THROW(j);
TEST_THROW(j); ((void)j);
}
template <class Ret, class CheckLamdba, class ...Args>

View File

@@ -22,7 +22,6 @@
void func(std::promise<int> p)
{
const int i = 5;
p.set_exception_at_thread_exit(std::make_exception_ptr(3));
}

View File

@@ -31,7 +31,7 @@ public:
long operator()(long i, long j) const {return data_ + i + j;}
};
void func(std::packaged_task<double(int, char)> p)
void func(std::packaged_task<double(int, char)>)
{
}

View File

@@ -60,6 +60,8 @@ void func2(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
#else
((void)p);
#endif
}
@@ -74,6 +76,8 @@ void func3(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
#else
((void)p);
#endif
}

View File

@@ -60,6 +60,8 @@ void func2(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
#else
((void)p);
#endif
}
@@ -74,6 +76,8 @@ void func3(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
#else
((void)p);
#endif
}

View File

@@ -45,7 +45,7 @@ int test2 = 0;
int runs = 0;
void f()
void f(bool expect_result)
{
typedef std::chrono::system_clock Clock;
typedef std::chrono::milliseconds milliseconds;
@@ -54,7 +54,8 @@ void f()
test1 = 1;
cv.notify_one();
Clock::time_point t0 = Clock::now();
bool r = cv.wait_for(lk, milliseconds(250), Pred(test2));
bool result = cv.wait_for(lk, milliseconds(250), Pred(test2));
assert(result == expect_result);
Clock::time_point t1 = Clock::now();
if (runs == 0)
{
@@ -73,7 +74,7 @@ int main()
{
{
L1 lk(m0);
std::thread t(f);
std::thread t(f, /*expect_result*/true);
assert(test1 == 0);
while (test1 == 0)
cv.wait(lk);
@@ -87,7 +88,7 @@ int main()
test2 = 0;
{
L1 lk(m0);
std::thread t(f);
std::thread t(f, /*expect_result*/false);
assert(test1 == 0);
while (test1 == 0)
cv.wait(lk);

View File

@@ -28,7 +28,7 @@ int main()
typedef std::try_to_lock_t T2;
typedef std::adopt_lock_t T3;
T1 t1 = std::defer_lock;
T2 t2 = std::try_to_lock;
T3 t3 = std::adopt_lock;
T1 t1 = std::defer_lock; ((void)t1);
T2 t2 = std::try_to_lock; ((void)t2);
T3 t3 = std::adopt_lock; ((void)t3);
}

View File

@@ -58,7 +58,6 @@ int main()
{
G g;
std::thread t0(g, 5, 5.5);
std::thread::id id = t0.get_id();
std::thread t1;
t0 = std::move(t1);
assert(false);

View File

@@ -50,7 +50,8 @@ int main()
std::thread::id id0 = t0.get_id();
std::thread t1;
std::thread::id id1 = t1.get_id();
assert(t0.get_id() != id1);
assert(t0.get_id() == id0);
assert(id0 != id1);
assert(t1.get_id() == std::thread::id());
t0.join();
}

View File

@@ -103,6 +103,8 @@ void checkThrows(any& a)
} catch (...) {
assert(false);
}
#else
((void)a);
#endif
}

View File

@@ -29,7 +29,7 @@ struct DummyUnaryFunction
struct BadUnaryFunction
{
template <typename S>
constexpr int operator()(S const & s) const
constexpr int operator()(S const &) const
{
// Trigger a compile error if this function is instantiated.
// The constexpr is needed so that it is instantiated while checking

View File

@@ -56,8 +56,32 @@ constexpr decltype(std::placeholders::_9) cp9 = std::placeholders::_9;
constexpr decltype(std::placeholders::_10) cp10 = std::placeholders::_10;
#endif // TEST_STD_VER >= 11
void use_placeholders_to_prevent_unused_warning() {
((void)cp1);
((void)cp2);
((void)cp3);
((void)cp4);
((void)cp5);
((void)cp6);
((void)cp7);
((void)cp8);
((void)cp9);
((void)cp10);
((void)default1);
((void)default2);
((void)default3);
((void)default4);
((void)default5);
((void)default6);
((void)default7);
((void)default8);
((void)default9);
((void)default10);
}
int main()
{
use_placeholders_to_prevent_unused_warning();
test(std::placeholders::_1);
test(std::placeholders::_2);
test(std::placeholders::_3);

View File

@@ -138,26 +138,26 @@ inline constexpr CallType operator|(CallType LHS, CallType RHS) {
struct ForwardingCallObject {
template <class ...Args>
bool operator()(Args&&... args) & {
bool operator()(Args&&...) & {
set_call<Args&&...>(CT_NonConst | CT_LValue);
return true;
}
template <class ...Args>
bool operator()(Args&&... args) const & {
bool operator()(Args&&...) const & {
set_call<Args&&...>(CT_Const | CT_LValue);
return true;
}
// Don't allow the call operator to be invoked as an rvalue.
template <class ...Args>
bool operator()(Args&&... args) && {
bool operator()(Args&&...) && {
set_call<Args&&...>(CT_NonConst | CT_RValue);
return true;
}
template <class ...Args>
bool operator()(Args&&... args) const && {
bool operator()(Args&&...) const && {
set_call<Args&&...>(CT_Const | CT_RValue);
return true;
}
@@ -526,7 +526,6 @@ void call_operator_forwarding_test()
assert(Fn::check_call<int&&>(CT_Const | CT_RValue));
}
{ // test multi arg
int x = 42;
const double y = 3.14;
std::string s = "abc";
obj(42, std::move(y), s, std::string{"foo"});

View File

@@ -24,4 +24,5 @@ int main()
{
std::default_delete<int[]> d1;
std::default_delete<const int[]> d2 = d1;
((void)d2);
}

View File

@@ -38,7 +38,7 @@ source1()
return std::unique_ptr<A[]>(new A[3]);
}
void sink1(std::unique_ptr<A[]> p)
void sink1(std::unique_ptr<A[]>)
{
}
@@ -48,7 +48,7 @@ source2()
return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
}
void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
void sink2(std::unique_ptr<A[], Deleter<A[]> >)
{
}
@@ -59,7 +59,7 @@ source3()
return std::unique_ptr<A[], NCDeleter<A[]>&>(new A[3], d);
}
void sink3(std::unique_ptr<A[], NCDeleter<A[]>&> p)
void sink3(std::unique_ptr<A[], NCDeleter<A[]>&>)
{
}

View File

@@ -87,6 +87,7 @@ void test_implicit()
using T = ImplicitThrow;
optional<T> t = 42;
assert(false);
((void)t);
} catch (int) {
}
}

View File

@@ -91,6 +91,8 @@ int main() {
}
{
std::tuple<A&&> t(std::forward_as_tuple(A{}));
((void)t);
std::tuple<ExplicitA&&> t2(std::forward_as_tuple(ExplicitA{}));
((void)t2);
}
}

View File

@@ -47,30 +47,30 @@ struct ExplicitDerived : std::tuple<T> {
int main() {
{
std::tuple<Explicit> foo = Derived<int>{42};
std::tuple<Explicit> foo = Derived<int>{42}; ((void)foo);
assert(count == 1);
std::tuple<Explicit> bar(Derived<int>{42});
std::tuple<Explicit> bar(Derived<int>{42}); ((void)bar);
assert(count == 2);
}
count = 0;
{
std::tuple<Implicit> foo = Derived<int>{42};
std::tuple<Implicit> foo = Derived<int>{42}; ((void)foo);
assert(count == 1);
std::tuple<Implicit> bar(Derived<int>{42});
std::tuple<Implicit> bar(Derived<int>{42}); ((void)bar);
assert(count == 2);
}
count = 0;
{
static_assert(!std::is_convertible<
ExplicitDerived<int>, std::tuple<Explicit>>::value, "");
std::tuple<Explicit> bar(ExplicitDerived<int>{42});
std::tuple<Explicit> bar(ExplicitDerived<int>{42}); ((void)bar);
assert(count == 1);
}
count = 0;
{
// FIXME: Libc++ incorrectly rejects this code.
#ifndef _LIBCPP_VERSION
std::tuple<Implicit> foo = ExplicitDerived<int>{42};
std::tuple<Implicit> foo = ExplicitDerived<int>{42}; ((void)foo);
static_assert(std::is_convertible<
ExplicitDerived<int>, std::tuple<Implicit>>::value,
"correct STLs accept this");
@@ -80,7 +80,7 @@ int main() {
"libc++ incorrectly rejects this");
#endif
assert(count == 0);
std::tuple<Implicit> bar(ExplicitDerived<int>{42});
std::tuple<Implicit> bar(ExplicitDerived<int>{42}); ((void)bar);
assert(count == 1);
}
count = 0;

View File

@@ -82,6 +82,7 @@ int main()
{
// check that the literal '0' can implicitly initialize a stored pointer.
std::tuple<int*> t = 0;
assert(std::get<0>(t) == nullptr);
}
{
std::tuple<int> t(2);

View File

@@ -29,7 +29,7 @@ struct ConstructsWithTupleLeaf
ConstructsWithTupleLeaf(ConstructsWithTupleLeaf &&) {}
template <class T>
ConstructsWithTupleLeaf(T t) {
ConstructsWithTupleLeaf(T) {
static_assert(!std::is_same<T, T>::value,
"Constructor instantiated for type other than int");
}

View File

@@ -371,7 +371,7 @@ struct CopyInsertable {
template <class ...Args>
CopyInsertable(Args&&... args) {
CopyInsertable(Args&&...) {
assert(false);
}

View File

@@ -117,7 +117,7 @@ struct AllocController {
}
template <class ...Args, class Alloc, class Tp>
void countConstruct(Alloc const& a, Tp *p) {
void countConstruct(Alloc const&, Tp *p) {
++construct_called;
last_construct_pointer = p;
last_construct_alloc = &makeTypeID<Alloc>();
@@ -126,7 +126,7 @@ struct AllocController {
}
template <class Alloc, class Tp>
void countDestroy(Alloc const& a, Tp *p) {
void countDestroy(Alloc const&, Tp *p) {
++destroy_called;
last_destroy_alloc = &makeTypeID<Alloc>();
last_destroy_type = &makeTypeID<Tp>();
@@ -263,7 +263,7 @@ public:
template <class U, class ...Args>
void construct(U *p, Args&&... args) {
auto *c = ::new ((void*)p) U(std::forward<Args>(args)...);
::new ((void*)p) U(std::forward<Args>(args)...);
P->countConstruct<Args&&...>(*this, p);
}

Some files were not shown because too many files have changed in this diff Show More