This fixes some warnings emitted when testing with warning flags added.
Some of these are only necessary when testing with -Wsystem-headers, but
either way it cleans up the tests to be less noisy under non-default
flags.
libstdc++-v3/ChangeLog:
* testsuite/18_support/96817.cc: Avoid -Wunused warnings.
* testsuite/20_util/any/assign/2.cc: Likewise.
* testsuite/20_util/any/cons/2.cc: Likewise.
* testsuite/20_util/align/1.cc: Avoid -Wsign-compare warning.
* testsuite/20_util/function/65760.cc: Avoid -Wunused warning.
* testsuite/20_util/function/1.cc: Avoid -Wcatch-value warning.
* testsuite/20_util/function/cons/move_target.cc: Avoid -Wunused
warning.
* testsuite/20_util/headers/memory/synopsis.cc: Add exception
specification.
* testsuite/20_util/monotonic_buffer_resource/allocate.cc: Avoid
-Wsign-compare warning.
* testsuite/20_util/tuple/cons/deduction.cc: Avoid -Wunused
warning.
* testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc:
Avoid -Wdeprecated-copy warning.
* testsuite/21_strings/basic_string/56166.cc: Avoid
-Wcatch-value warning.
* testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
Avoid -Wcatch-value warnings.
* testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc:
Likewise.
* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc:
Prune additional diagnostics.
* testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc:
Likewise.
* testsuite/21_strings/headers/string/synopsis.cc: Add exception
specifications.
* testsuite/22_locale/locale/cons/12352.cc: Define sized
delete operators to avoid warnings.
* testsuite/23_containers/deque/modifiers/swap/1.cc: Add
exception specification.
* testsuite/23_containers/forward_list/cons/11.cc: Avoid
-Wdeprecated-copy warning.
* testsuite/23_containers/headers/bitset/synopsis.cc: Add
exception specification.
* testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
* testsuite/23_containers/headers/forward_list/synopsis.cc:
Likewise.
* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
* testsuite/23_containers/headers/map/synopsis.cc: Likewise.
* testsuite/23_containers/headers/queue/synopsis.cc: Likewise.
* testsuite/23_containers/headers/set/synopsis.cc: Likewise.
* testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
* testsuite/23_containers/list/modifiers/swap/1.cc: Likewise.
* testsuite/23_containers/map/modifiers/swap/1.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/swap/1.cc:
Likewise.
* testsuite/23_containers/multiset/modifiers/swap/1.cc:
Likewise.
* testsuite/23_containers/set/modifiers/swap/1.cc: Likewise.
* testsuite/23_containers/unordered_set/56267-2.cc: Avoid
-Wdeprecated-copy warning.
* testsuite/23_containers/vector/bool/23632.cc: Avoid
-Wempty-body warning.
* testsuite/23_containers/vector/modifiers/swap/1.cc: Add
exception specification.
* testsuite/25_algorithms/heap/moveable2.cc: Fix misplaced
parentheses around arguments.
* testsuite/25_algorithms/sample/1.cc: Use return value.
* testsuite/25_algorithms/search/searcher.cc: Avoid -Wunused
warnings.
* testsuite/27_io/basic_ostream/exceptions/char/9561.cc:
Likewise.
* testsuite/27_io/basic_ostream/exceptions/wchar_t/9561.cc:
Likewise.
* testsuite/27_io/filesystem/operations/remove_all.cc: Avoid
-Wsign-compare warning.
* testsuite/experimental/any/assign/2.cc: Avoid -Wunused warnings.
* testsuite/experimental/any/cons/2.cc: Likewise.
* testsuite/experimental/filesystem/operations/remove_all.cc:
Avoid -Wign-compare warning.
* testsuite/experimental/memory/observer_ptr/cons/cons.cc:
Likewise.
* testsuite/experimental/memory_resource/null_memory_resource.cc:
Likewise.
* testsuite/experimental/source_location/1.cc: Avoid -Waddress
warning.
* testsuite/ext/pod_char_traits.cc: Avoid -Wunused warning.
* testsuite/ext/vstring/modifiers/clear/56166.cc: Avoid
-Wcatch-value.
* testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc:
Avoid -Wunused warning.
* testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc:
Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
Prune additional warnings.
* testsuite/tr1/3_function_objects/function/1.cc: Avoid
-Wcatch-value warning.
* testsuite/util/replacement_memory_operators.h: Define sized
delete to avoid warnings.
* testsuite/util/testsuite_api.h (_NonDefaultConstructible): Add
user-declared assignment operator to stop -Wdeprecated-copy
warnings.
* testsuite/util/testsuite_containers.h: Avoid -Wunused warning.
* testsuite/util/testsuite_iterators.h: Avoid -Wsign-compare
warnings.
* testsuite/util/testsuite_new_operators.h: Define sized deleted.
void clean_terminate() { _Exit(0); }
int
-main (int argc, char **argv)
+main ()
{
std::set_terminate(clean_terminate);
init();
void
test01()
{
+ using std::size_t;
+
size_t space = 100;
void* ptr = new char[space];
char* const orig_ptr = static_cast<char*>(ptr);
uintptr_t p = reinterpret_cast<uintptr_t>(ptr);
VERIFY( p % alignment == 0 );
char* const x = static_cast<char*>(ptr);
- VERIFY( x - old_ptr == old_space - space );
+ VERIFY( size_t(x - old_ptr) == old_space - space );
VERIFY( (void*)x < (void*)(orig_ptr + orig_space) );
VERIFY( (void*)(x + size) < (void*)(orig_ptr + orig_space) );
ptr = x + size;
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
f1(3.14159f);
VERIFY( false );
}
- catch (bad_function_call)
+ catch (const bad_function_call&)
{
thrown = true;
}
C operator()(int, int);
};
-int main() {
- C c = C();
-}
-
+C c = C();
~moveable() = default;
// target object must be CopyConstructible,
// but should not be copied during this test
- moveable(const moveable& c) { throw "copied"; }
+ moveable(const moveable&) { throw "copied"; }
moveable& operator=(const moveable&) = delete;
moveable(moveable&&) { }
#include <memory>
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#endif
+
namespace std {
// lib.default.allocator, the default allocator:
template <class T> class allocator;
// lib.temporary.buffer, temporary buffers:
template <class T>
- pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n);
+ pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) NOTHROW;
template <class T>
void return_temporary_buffer(T* p);
{
std::size_t size = 1 << i;
void* ptr = mr.allocate(size, 1);
- VERIFY( ((char*)ptr - (char*)prev_ptr) == prev_size );
+ VERIFY( std::size_t((char*)ptr - (char*)prev_ptr) == prev_size );
prev_ptr = ptr;
prev_size = size;
}
c(void* o = 0) : m(o) {}
c(const c &r) : m(r.m) {}
+ c& operator=(const c &) = default;
+
template<class T>
explicit c(T &o) : m((void*)0xdeadbeef) { }
};
std::pair<int, unsigned> p;
std::tuple x = p;
check_type<std::tuple<int, unsigned>>(x);
- int y = 42;
std::tuple x2{p};
check_type<std::tuple<int, unsigned>>(x2);
- const int z = 666;
std::pair<const int, unsigned> p2;
std::tuple x3{p2};
check_type<std::tuple<const int, unsigned>>(x3);
fail_after = i;
f();
break;
- } catch (std::bad_alloc) {
+ } catch (const std::bad_alloc&) {
}
}
}
try
{
string one;
- stod(one);
+ stod(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stod(one);
+ stod(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("2.0a");
- d1 = stod(one, &idx1);
+ d1 = stod(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<double>::max_exponent10, '9');
d1 = stod(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
string one(to_string(ld1));
d1 = stod(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stof(one);
+ stof(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stof(one);
+ stof(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("2.0a");
- f1 = stof(one, &idx1);
+ f1 = stof(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<float>::max_exponent10, '9');
f1 = stof(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
string one(to_string(ld1));
f1 = stof(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stoi(one);
+ stoi(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stoi(one);
+ stoi(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- i1 = stoi(one, 0, 16);
+ i1 = stoi(one, 0, 16);
}
catch(...)
{
try
{
string one("78");
- i1 = stoi(one, &idx1, 8);
+ i1 = stoi(one, &idx1, 8);
}
catch(...)
{
try
{
string one("10112");
- i1 = stoi(one, &idx1, 2);
+ i1 = stoi(one, &idx1, 2);
}
catch(...)
{
try
{
string one("0XE");
- i1 = stoi(one, &idx1, 0);
+ i1 = stoi(one, &idx1, 0);
}
catch(...)
{
string one(1000, '9');
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
string one(to_string(ll0));
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
string one(to_string(ll1));
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stol(one);
+ stol(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stol(one);
+ stol(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- l1 = stol(one, 0, 16);
+ l1 = stol(one, 0, 16);
}
catch(...)
{
try
{
string one("78");
- l1 = stol(one, &idx1, 8);
+ l1 = stol(one, &idx1, 8);
}
catch(...)
{
try
{
string one("10112");
- l1 = stol(one, &idx1, 2);
+ l1 = stol(one, &idx1, 2);
}
catch(...)
{
try
{
string one("0XE");
- l1 = stol(one, &idx1, 0);
+ l1 = stol(one, &idx1, 0);
}
catch(...)
{
string one(1000, '9');
l1 = stol(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stold(one);
+ stold(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stold(one);
+ stold(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("2.0a");
- ld1 = stold(one, &idx1);
+ ld1 = stold(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<long double>::max_exponent10, '9');
ld1 = stold(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stoll(one);
+ stoll(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stoll(one);
+ stoll(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- ll1 = stoll(one, 0, 16);
+ ll1 = stoll(one, 0, 16);
}
catch(...)
{
try
{
string one("78");
- ll1 = stoll(one, &idx1, 8);
+ ll1 = stoll(one, &idx1, 8);
}
catch(...)
{
try
{
string one("10112");
- ll1 = stoll(one, &idx1, 2);
+ ll1 = stoll(one, &idx1, 2);
}
catch(...)
{
try
{
string one("0XE");
- ll1 = stoll(one, &idx1, 0);
+ ll1 = stoll(one, &idx1, 0);
}
catch(...)
{
string one(1000, '9');
ll1 = stoll(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stoul(one);
+ stoul(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- stoul(one);
+ stoul(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- ul1 = stoul(one, 0, 16);
+ ul1 = stoul(one, 0, 16);
}
catch(...)
{
try
{
string one("78");
- ul1 = stoul(one, &idx1, 8);
+ ul1 = stoul(one, &idx1, 8);
}
catch(...)
{
try
{
string one("10112");
- ul1 = stoul(one, &idx1, 2);
+ ul1 = stoul(one, &idx1, 2);
}
catch(...)
{
try
{
string one("0XE");
- ul1 = stoul(one, &idx1, 0);
+ ul1 = stoul(one, &idx1, 0);
}
catch(...)
{
string one(1000, '9');
ul1 = stoul(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
string one;
- stoull(one);
+ stoull(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
{
}
VERIFY( test );
-
+
test = false;
try
{
string one("a");
- stoull(one);
+ stoull(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
string one("a");
- ull1 = stoull(one, 0, 16);
+ ull1 = stoull(one, 0, 16);
}
catch(...)
{
try
{
string one("78");
- ull1 = stoull(one, &idx1, 8);
+ ull1 = stoull(one, &idx1, 8);
}
catch(...)
{
try
{
string one("10112");
- ull1 = stoull(one, &idx1, 2);
+ ull1 = stoull(one, &idx1, 2);
}
catch(...)
{
try
{
string one("0XE");
- ull1 = stoull(one, &idx1, 0);
+ ull1 = stoull(one, &idx1, 0);
}
catch(...)
{
string one(1000, '9');
ull1 = stoull(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stod(one);
+ stod(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stod(one);
+ stod(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"2.0a");
- d1 = stod(one, &idx1);
+ d1 = stod(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<double>::max_exponent10, L'9');
d1 = stod(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
wstring one(to_wstring(ld1));
d1 = stod(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stof(one);
+ stof(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stof(one);
+ stof(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"2.0a");
- f1 = stof(one, &idx1);
+ f1 = stof(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<float>::max_exponent10, L'9');
f1 = stof(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
wstring one(to_wstring(ld1));
f1 = stof(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stoi(one);
+ stoi(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stoi(one);
+ stoi(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- i1 = stoi(one, 0, 16);
+ i1 = stoi(one, 0, 16);
}
catch(...)
{
try
{
wstring one(L"78");
- i1 = stoi(one, &idx1, 8);
+ i1 = stoi(one, &idx1, 8);
}
catch(...)
{
try
{
wstring one(L"10112");
- i1 = stoi(one, &idx1, 2);
+ i1 = stoi(one, &idx1, 2);
}
catch(...)
{
try
{
wstring one(L"0XE");
- i1 = stoi(one, &idx1, 0);
+ i1 = stoi(one, &idx1, 0);
}
catch(...)
{
wstring one(1000, L'9');
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
wstring one(to_wstring(ll0));
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
wstring one(to_wstring(ll1));
i1 = stoi(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stol(one);
+ stol(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stol(one);
+ stol(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- l1 = stol(one, 0, 16);
+ l1 = stol(one, 0, 16);
}
catch(...)
{
try
{
wstring one(L"78");
- l1 = stol(one, &idx1, 8);
+ l1 = stol(one, &idx1, 8);
}
catch(...)
{
try
{
wstring one(L"10112");
- l1 = stol(one, &idx1, 2);
+ l1 = stol(one, &idx1, 2);
}
catch(...)
{
try
{
wstring one(L"0XE");
- l1 = stol(one, &idx1, 0);
+ l1 = stol(one, &idx1, 0);
}
catch(...)
{
wstring one(1000, L'9');
l1 = stol(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stold(one);
+ stold(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stold(one);
+ stold(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"2.0a");
- ld1 = stold(one, &idx1);
+ ld1 = stold(one, &idx1);
}
catch(...)
{
one.append(2 * numeric_limits<long double>::max_exponent10, L'9');
ld1 = stold(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stoll(one);
+ stoll(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stoll(one);
+ stoll(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- ll1 = stoll(one, 0, 16);
+ ll1 = stoll(one, 0, 16);
}
catch(...)
{
try
{
wstring one(L"78");
- ll1 = stoll(one, &idx1, 8);
+ ll1 = stoll(one, &idx1, 8);
}
catch(...)
{
try
{
wstring one(L"10112");
- ll1 = stoll(one, &idx1, 2);
+ ll1 = stoll(one, &idx1, 2);
}
catch(...)
{
try
{
wstring one(L"0XE");
- ll1 = stoll(one, &idx1, 0);
+ ll1 = stoll(one, &idx1, 0);
}
catch(...)
{
wstring one(1000, L'9');
ll1 = stoll(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stoul(one);
+ stoul(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- stoul(one);
+ stoul(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- ul1 = stoul(one, 0, 16);
+ ul1 = stoul(one, 0, 16);
}
catch(...)
{
try
{
wstring one(L"78");
- ul1 = stoul(one, &idx1, 8);
+ ul1 = stoul(one, &idx1, 8);
}
catch(...)
{
try
{
wstring one(L"10112");
- ul1 = stoul(one, &idx1, 2);
+ ul1 = stoul(one, &idx1, 2);
}
catch(...)
{
try
{
wstring one(L"0XE");
- ul1 = stoul(one, &idx1, 0);
+ ul1 = stoul(one, &idx1, 0);
}
catch(...)
{
wstring one(1000, L'9');
ul1 = stoul(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
try
{
wstring one;
- stoull(one);
+ stoull(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
{
}
VERIFY( test );
-
+
test = false;
try
{
wstring one(L"a");
- stoull(one);
+ stoull(one);
}
- catch(std::invalid_argument)
+ catch(const std::invalid_argument&)
{
test = true;
}
try
{
wstring one(L"a");
- ull1 = stoull(one, 0, 16);
+ ull1 = stoull(one, 0, 16);
}
catch(...)
{
try
{
wstring one(L"78");
- ull1 = stoull(one, &idx1, 8);
+ ull1 = stoull(one, &idx1, 8);
}
catch(...)
{
try
{
wstring one(L"10112");
- ull1 = stoull(one, &idx1, 2);
+ ull1 = stoull(one, &idx1, 2);
}
catch(...)
{
try
{
wstring one(L"0XE");
- ull1 = stoull(one, &idx1, 0);
+ ull1 = stoull(one, &idx1, 0);
}
catch(...)
{
wstring one(1000, L'9');
ull1 = stoull(one);
}
- catch(std::out_of_range)
+ catch(const std::out_of_range&)
{
test = true;
}
return s.compare((const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
return s.compare(0, 2, (const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
}
+
+// Ignore additional diagnostic given with -Wsystem-headers:
+// { dg-prune-output "argument 1 null where non-null expected" }
return s.find_first_not_of((const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
return s.find_first_not_of((const char*)nullptr, 1); // { dg-warning "\\\[-Wnonnull" }
}
+
+// Ignore additional diagnostic given with -Wsystem-headers:
+// { dg-prune-output "argument . null where non-null expected" }
return s.rfind((const char*)nullptr); // { dg-warning "\\\[-Wnonnull" }
return s.rfind((const char*)nullptr, 1); // { dg-warning "\\\[-Wnonnull" }
}
+
+// Ignore additional diagnostic given with -Wsystem-headers:
+// { dg-prune-output "argument . null where non-null expected" }
#include <string>
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
namespace std {
// lib.char.traits, character traits:
template<class charT>
template<class charT, class traits, class Allocator>
bool operator==(const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator==(const charT* lhs,
const basic_string<charT,traits,Allocator>& rhs);
const charT* rhs);
template<class charT, class traits, class Allocator>
bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator!=(const charT* lhs,
const basic_string<charT,traits,Allocator>& rhs);
template<class charT, class traits, class Allocator>
bool operator< (const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator< (const basic_string<charT,traits,Allocator>& lhs,
const charT* rhs);
const basic_string<charT,traits,Allocator>& rhs);
template<class charT, class traits, class Allocator>
bool operator> (const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator> (const basic_string<charT,traits,Allocator>& lhs,
const charT* rhs);
template<class charT, class traits, class Allocator>
bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
const charT* rhs);
const basic_string<charT,traits,Allocator>& rhs);
template<class charT, class traits, class Allocator>
bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
- const basic_string<charT,traits,Allocator>& rhs);
+ const basic_string<charT,traits,Allocator>& rhs) NOTHROW;
template<class charT, class traits, class Allocator>
bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
const charT* rhs);
// lib.string.special:
template<class charT, class traits, class Allocator>
void swap(basic_string<charT,traits,Allocator>& lhs,
- basic_string<charT,traits,Allocator>& rhs);
+ basic_string<charT,traits,Allocator>& rhs)
+#if __cplusplus >= 201103L
+ noexcept(noexcept(lhs.swap(rhs)))
+#endif
+ ;
template<class charT, class traits, class Allocator>
basic_istream<charT,traits>&
deallocate(p);
}
+#if __cpp_sized_deallocation
+void operator delete(void* p, std::size_t) throw()
+{
+ deallocate(p);
+}
+
+void operator delete[](void* p, std::size_t) throw()
+{
+ deallocate(p);
+}
+#endif
+
void* operator new(std::size_t n, const std::nothrow_t&) throw()
{
return allocate(n);
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <deque>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
int swap_calls;
namespace std
{
- template<>
- void
- deque<T, allocator<T> >::swap(deque<T, allocator<T> >&)
+ template<>
+ void
+ deque<T, allocator<T> >::swap(deque<T, allocator<T> >&) NOTHROW
{ ++swap_calls; }
}
{
A() = default;
A(const A&) { if (fail) throw fail; }
+ A& operator=(const A&) = default;
};
void test01()
#include <bitset>
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
namespace std {
template <size_t N> class bitset;
// 23.3.5.3 bitset operations:
template <size_t N>
- bitset<N> operator&(const bitset<N>&, const bitset<N>&);
+ bitset<N> operator&(const bitset<N>&, const bitset<N>&) NOTHROW;
template <size_t N>
- bitset<N> operator|(const bitset<N>&, const bitset<N>&);
+ bitset<N> operator|(const bitset<N>&, const bitset<N>&) NOTHROW;
template <size_t N>
- bitset<N> operator^(const bitset<N>&, const bitset<N>&);
+ bitset<N> operator^(const bitset<N>&, const bitset<N>&) NOTHROW;
template <class charT, class traits, size_t N>
basic_istream<charT, traits>&
#include <deque>
+#if __cplusplus >= 201103L
+# define NOTHROW(X) noexcept(X)
+#else
+# define NOTHROW(X)
+#endif
+
namespace std {
template <class T, class Allocator> class deque;
bool operator<= (const deque<T,Allocator>& x, const deque<T,Allocator>& y);
template <class T, class Allocator>
- void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);
+ void swap(deque<T,Allocator>& x, deque<T,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
}
const forward_list<T,Allocator>&);
template <class T, class Allocator>
- void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y);
+ void swap(forward_list<T,Allocator>& x, forward_list<T,Allocator>& y)
+ noexcept(noexcept(x.swap(y)));
}
#include <list>
+#if __cplusplus >= 201103L
+# define NOTHROW(X) noexcept(X)
+#else
+# define NOTHROW(X)
+#endif
+
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template <class T, class Allocator> class list;
bool operator<=(const list<T,Allocator>& x, const list<T,Allocator>&);
template <class T, class Allocator>
- void swap(list<T,Allocator>& x, list<T,Allocator>& y);
+ void swap(list<T,Allocator>& x, list<T,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
}
#include <map>
+#if __cplusplus >= 201103L
+# define NOTHROW(X) noexcept(X)
+#else
+# define NOTHROW(X)
+#endif
+
namespace std {
template <class Key, class T, class Compare, class Allocator>
class map;
const map<Key,T,Compare,Allocator>& y);
template <class Key, class T, class Compare, class Allocator>
void swap(map<Key,T,Compare,Allocator>& x,
- map<Key,T,Compare,Allocator>& y);
+ map<Key,T,Compare,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
template <class Key, class T, class Compare, class Allocator>
class multimap;
const multimap<Key,T,Compare,Allocator>& y);
template <class Key, class T, class Compare, class Allocator>
void swap(multimap<Key,T,Compare,Allocator>& x,
- multimap<Key,T,Compare,Allocator>& y);
+ multimap<Key,T,Compare,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
}
#include <queue>
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
namespace std {
template <class T, class Container> class queue;
template <class T, class Container>
#include <set>
+#if __cplusplus >= 201103L
+# define NOTHROW(X) noexcept(X)
+#else
+# define NOTHROW(X)
+#endif
+
namespace std {
template <class Key, class Compare, class Allocator>
class set;
template <class Key, class Compare, class Allocator>
void swap(set<Key,Compare,Allocator>& x,
- set<Key,Compare,Allocator>& y);
+ set<Key,Compare,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
template <class Key, class Compare, class Allocator>
class multiset;
template <class Key, class Compare, class Allocator>
void swap(multiset<Key,Compare,Allocator>& x,
- multiset<Key,Compare,Allocator>& y);
+ multiset<Key,Compare,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
}
#include <vector>
+#if __cplusplus >= 201103L
+# define NOTHROW(X) noexcept(X)
+#else
+# define NOTHROW(X)
+#endif
+
namespace std {
template <class T, class Allocator> class vector;
const vector<T,Allocator>& y);
template <class T, class Allocator>
- void swap(vector<T,Allocator>& x, vector<T,Allocator>& y);
+ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
+ NOTHROW(noexcept(x.swap(y)));
template <class Allocator> class vector<bool,Allocator>;
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <list>
#include "1.h"
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
namespace std
{
- template<>
- void
- list<T, allocator<T> >::swap(list<T, allocator<T> >&)
+ template<>
+ void
+ list<T, allocator<T> >::swap(list<T, allocator<T> >&) NOTHROW
{ ++swap_calls; }
}
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <map>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
// T must be LessThanComparable to pass concept-checks
namespace std
{
- template<>
- void
- map<T, int>::swap(map<T, int>&)
+ template<>
+ void
+ map<T, int>::swap(map<T, int>&) NOTHROW
{ ++swap_calls; }
}
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <map>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
// T must be LessThanComparable to pass concept-checks
namespace std
{
- template<>
- void
- multimap<T, int>::swap(multimap<T, int>&)
+ template<>
+ void
+ multimap<T, int>::swap(multimap<T, int>&) NOTHROW
{ ++swap_calls; }
}
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <set>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
// T must be LessThanComparable to pass concept-checks
namespace std
{
- template<>
- void
- multiset<T>::swap(multiset<T>&)
+ template<>
+ void
+ multiset<T>::swap(multiset<T>&) NOTHROW
{ ++swap_calls; }
}
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <set>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
// T must be LessThanComparable to pass concept-checks
namespace std
{
- template<>
- void
- set<T>::swap(set<T>&)
+ template<>
+ void
+ set<T>::swap(set<T>&) NOTHROW
{ ++swap_calls; }
}
audrey2hash(int) { }
+ audrey2hash(const audrey2hash&) = default;
+
audrey2hash&
operator=(const audrey2hash&) { throw "Don't assign the plants"; }
};
const std::vector<bool>::const_iterator cfu = v.begin();
if (cfu[0])
- ;
+ {
+ }
}
int main()
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
-
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-
+
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <vector>
#include <testsuite_hooks.h>
-
+
+#if __cplusplus >= 201103L
+# define NOTHROW noexcept
+#else
+# define NOTHROW
+#endif
+
struct T { int i; };
int swap_calls;
namespace std
{
- template<>
- void
- vector<T, allocator<T> >::swap(vector<T, allocator<T> >&)
+ template<>
+ void
+ vector<T, allocator<T> >::swap(vector<T, allocator<T> >&) NOTHROW
{ ++swap_calls; }
}
bool are_ordered_int(const int& lhs, const int& rhs)
{ return lhs < rhs; }
-void
+void
check_make(int* array, int length)
{
rvalstruct makeheap[9];
int makeheap_ref[9];
std::copy(array, array + length, makeheap);
- std::copy(array, array + length, makeheap_ref);
+ std::copy(array, array + length, makeheap_ref);
container makecon(makeheap, makeheap + length);
container_ref makecon_ref(makeheap_ref, makeheap_ref + length);
std::make_heap(makecon.begin(), makecon.end(), are_ordered);
std::pop_heap(popcon_ref.begin(), popcon_ref.end(), are_ordered_int);
for (int z = 0; z < length; ++z)
VERIFY( popheap[z] == popheap_ref[z] );
- VERIFY( (std::__is_heap(popheap, popheap + length - 1), are_ordered) );
+ VERIFY( std::__is_heap(popheap, popheap + length - 1, are_ordered) );
for (int z = 0; z < length; ++z)
VERIFY( popheap[z].val <= popheap[length-1].val && popheap[z].valid );
}
rvalstruct pushheap[10];
int pushheap_ref[10];
std::copy(array, array + length, pushheap);
- std::copy(array, array + length, pushheap_ref);
+ std::copy(array, array + length, pushheap_ref);
pushheap[length] = pushval;
pushheap_ref[length] = pushval;
container pushcon(pushheap, pushheap + length + 1);
// forward iterator for population and output iterator for result
auto res = sample(pop.begin(), pop.end(), samp.begin(), sample_size, rng);
+ VERIFY( res.ptr == (out + sample_size) );
// verify no duplicates
std::sort(std::begin(out), std::end(out));
struct P { int* first; };
- P operator()(int* f, int* l) const { return {f}; }
+ P operator()(int* f, int*) const { return {f}; }
};
void
{
strm << std::endl;
}
- catch(foobar)
+ catch(const foobar&)
{
// strm should throw foobar and not do anything else
VERIFY(strm.bad());
{
strm << std::endl;
}
- catch(foobar)
+ catch(const foobar&)
{
// strm should throw foobar and not do anything else
VERIFY(strm.bad());
// remove write permission on the directory:
fs::permissions(dir, fs::perms::owner_read|fs::perms::owner_exec);
n = fs::remove_all(dir, ec);
- VERIFY( n == -1 );
+ VERIFY( n == std::uintmax_t(-1) );
VERIFY( ec == std::errc::permission_denied ); // not ENOTEMPTY
try {
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
{
X() = default;
X(const X&) { copied = true; }
- X(X&& x) { moved = true; }
+ X(X&&) { moved = true; }
};
struct X2
{
X2() = default;
X2(const X2&) { copied = true; }
- X2(X2&& x) noexcept { moved = true; }
+ X2(X2&&) noexcept { moved = true; }
};
void test01()
// remove write permission on the directory:
fs::permissions(dir, fs::perms::owner_read|fs::perms::owner_exec);
n = fs::remove_all(dir, ec);
- VERIFY( n == -1 );
+ VERIFY( n == std::uintmax_t(-1) );
VERIFY( ec == std::errc::permission_denied ); // not ENOTEMPTY
try {
void test03()
{
- int x{};
observer_ptr<int> a;
observer_ptr<const int> b{a};
VERIFY(a == b);
memory_resource* r = null_memory_resource();
bool caught = false;
- void* p = nullptr;
+ void* p __attribute__((unused)) = nullptr;
try {
p = r->allocate(1);
} catch (const std::bad_alloc&) {
// { dg-do run { target c++14 } }
// { dg-require-cstdint "" }
+// { dg-options "-Wno-address" }
#include <experimental/source_location>
#include <experimental/string_view>
test01()
{
constexpr source_location loc = source_location::current();
- static_assert( loc.line() == 31 );
+ static_assert( loc.line() == 32 );
// static_assert( loc.column() == 35 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
void test02()
{
S s0;
- VERIFY( s0.loc.line() == 53 );
+ VERIFY( s0.loc.line() == 54 );
// static_assert( s0.loc.column() == 7 );
VERIFY( s0.loc.file_name() == __FILE__ );
VERIFY( s0.loc.function_name() == string_view(__FUNCTION__) );
S s1(1);
- VERIFY( s1.loc.line() == 47 );
+ VERIFY( s1.loc.line() == 48 );
VERIFY( s1.loc.file_name() == __FILE__ );
VERIFY( s1.loc.function_name() == s1.func );
}
void test03()
{
auto loc = f(); // f's first argument corresponds to this line of code
- VERIFY( loc.line() == 77 );
+ VERIFY( loc.line() == 78 );
// static_assert( loc.column() == 16 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
source_location c = source_location::current();
loc = f(c); // f's first argument gets the same values as c, above
- VERIFY( loc.line() == 83 );
+ VERIFY( loc.line() == 84 );
// static_assert( loc.column() == 23 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == string_view(__FUNCTION__) );
string_view func;
loc = g(func);
- VERIFY( loc.line() == 70 );
+ VERIFY( loc.line() == 71 );
// static_assert( loc.column() == 23 );
VERIFY( loc.file_name() == __FILE__ );
VERIFY( loc.function_name() == func );
// Benjamin Kosnik <bkoz@redhat.com>
#include <ext/pod_char_traits.h>
+#include <testsuite_hooks.h>
int main()
{
char_type c1 = { uc1 };
char_type c2 = { uc2 };
test = !(c1 == c2);
+ VERIFY( test );
// 2 char_traits
test = traits_type::eq(c1, c2);
-
+ VERIFY( ! test );
+
// 3 basic_string<char_type>
typedef std::basic_string<char_type> string_type;
string_type str;
fail_after = i;
f();
break;
- } catch (std::bad_alloc) {
+ } catch (const std::bad_alloc&) {
}
}
}
constexpr void swap(U& l, U& r) { l.i = r.i = 99; }
}
-constexpr bool check_struct_with_adl_swap(int i)
+constexpr bool check_struct_with_adl_swap(int)
{
nu::S s1, s2;
std::ranges::swap(s1, s2);
static_assert(check_struct_with_adl_swap(1));
-constexpr bool check_array_with_adl_swap(int i)
+constexpr bool check_array_with_adl_swap(int)
{
nu::S s1[2], s2[2];
std::ranges::swap(s1, s2);
namespace nu
{
struct S { bool swapped = false; };
- constexpr void swap(S& l, S& r) { }
+ constexpr void swap(S&, S&) { }
struct T { int i; };
union U { char c; int i; };
- constexpr void swap(U& l, U& r) { }
+ constexpr void swap(U&, U&) { }
}
static_assert( std::swappable<nu::S> );
std::tr1::shared_ptr<X> p9(ap()); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 593 }
}
+
+// Ignore additional diagnostic given with -Wsystem-headers:
+// { dg-prune-output "has incomplete type" }
+// { dg-prune-output "possible problem detected" }
f1(3.14159f);
VERIFY( false );
}
- catch (bad_function_call)
+ catch (const bad_function_call&)
{
thrown = true;
}
std::printf("%lu allocations to be released \n", (unsigned long)count);
}
}
+
+#if __cpp_sized_deallocation
+void operator delete(void* p, std::size_t) throw() { ::operator delete(p); }
+#endif
NonDefaultConstructible(const NonDefaultConstructible&) { }
#if __cplusplus >= 201103L
+ NonDefaultConstructible&
+ operator=(const NonDefaultConstructible&) = default;
+
// For std::iota.
NonDefaultConstructible&
operator++()
template<typename _Tp>
struct reverse_members<_Tp, false>
{
- reverse_members(_Tp& container) { }
+ reverse_members(_Tp&) { }
};
template<typename _Iterator,
ItType<T>
it(int pos)
{
- ITERATOR_VERIFY(pos >= 0 && pos <= size());
+ ITERATOR_VERIFY(pos >= 0 && (unsigned)pos <= size());
return ItType<T>(bounds.first + pos, &bounds);
}
std::free(p);
}
+#if __cpp_sized_deallocation
+void operator delete(void* p, std::size_t) throw()
+{ ::operator delete(p); }
+#endif
+
void operator delete(void* p, const std::nothrow_t&) throw()
{
if (p)