// -*- C++ -*-
// Testing utilities for the rvalue reference.
//
-// Copyright (C) 2005-2016 Free Software Foundation, Inc.
+// Copyright (C) 2005-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
rvalstruct&
operator=(int newval)
- {
+ {
val = newval;
valid = true;
return *this;
rvalstruct(rvalstruct&& in)
{
- bool test __attribute__((unused)) = true;
VERIFY( in.valid == true );
val = in.val;
in.valid = false;
rvalstruct&
operator=(rvalstruct&& in)
{
- bool test __attribute__((unused)) = true;
VERIFY( this != &in );
VERIFY( in.valid == true );
val = in.val;
}
};
- inline bool
+ inline bool
operator==(const rvalstruct& lhs, const rvalstruct& rhs)
{ return lhs.val == rhs.val; }
void
swap(rvalstruct& lhs, rvalstruct& rhs)
{
- bool test __attribute__((unused)) = true;
VERIFY( lhs.valid && rhs.valid );
int temp = lhs.val;
lhs.val = rhs.val;
static int copycount;
int val;
bool valid;
-
+
copycounter() : val(0), valid(true)
{ }
copycounter(const copycounter& in) : val(in.val), valid(true)
{
- bool test __attribute__((unused)) = true;
VERIFY( in.valid == true );
++copycount;
}
copycounter(copycounter&& in) noexcept
{
- bool test __attribute__((unused)) = true;
VERIFY( in.valid == true );
val = in.val;
in.valid = false;
valid = true;
}
-
+
copycounter&
operator=(int newval)
- {
+ {
val = newval;
valid = true;
return *this;
}
bool
- operator=(const copycounter& in)
+ operator=(const copycounter& in)
{
- bool test __attribute__((unused)) = true;
VERIFY( in.valid == true );
++copycount;
val = in.val;
copycounter&
operator=(copycounter&& in)
{
- bool test __attribute__((unused)) = true;
VERIFY(in.valid == true);
val = in.val;
in.valid = false;
valid = true;
return *this;
}
-
+
~copycounter() noexcept
{ valid = false; }
};
int copycounter::copycount = 0;
-
+
inline bool
operator==(const copycounter& lhs, const copycounter& rhs)
{ return lhs.val == rhs.val; }
inline void
swap(copycounter& lhs, copycounter& rhs)
{
- bool test __attribute__((unused)) = true;
VERIFY( lhs.valid && rhs.valid );
int temp = lhs.val;
lhs.val = rhs.val;
rvalstruct_compare_by_value(const rvalstruct_compare_by_value& rh)
: val(rh.val), ok(rh.ok)
{
- bool test __attribute__((unused)) = true;
VERIFY(rh.ok);
}
rvalstruct_compare_by_value&
operator=(const rvalstruct_compare_by_value& rh)
{
- bool test __attribute__((unused)) = true;
VERIFY( rh.ok );
val = rh.val;
ok = rh.ok;
rvalstruct_compare_by_value(rvalstruct_compare_by_value&& rh)
: val(rh.val), ok(rh.ok)
{
- bool test __attribute__((unused)) = true;
VERIFY( rh.ok );
rh.ok = false;
}
rvalstruct_compare_by_value&
operator=(rvalstruct_compare_by_value&& rh)
{
- bool test __attribute__((unused)) = true;
VERIFY( rh.ok );
val = rh.val;
ok = rh.ok;
operator<(rvalstruct_compare_by_value lh,
rvalstruct_compare_by_value rh)
{
- bool test __attribute__((unused)) = true;
VERIFY( rh.ok );
VERIFY( lh.ok );
return lh.val < rh.val;
order(rvalstruct_compare_by_value lh,
rvalstruct_compare_by_value rh)
{
- bool test __attribute__((unused)) = true;
VERIFY( rh.ok );
VERIFY( lh.ok );
return lh.val < rh.val;