Index: test/std/input.output/iostreams.base/fpos/fpos.operations/fpos.pass.cpp =================================================================== --- /dev/null +++ test/std/input.output/iostreams.base/fpos/fpos.operations/fpos.pass.cpp @@ -0,0 +1,103 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "test_macros.h" + +#include +#include +#include + +// + +// template +// class fpos; + +// UNSUPPORTED: c++98, c++03 + +template +struct is_equality_comparable : std::false_type { }; + +template +struct is_equality_comparable +() == std::declval(), (void)0)>::type +> : std::true_type { }; + +template +void test_traits() +{ + static_assert(std::is_default_constructible >::value); + static_assert(std::is_copy_constructible >::value); + static_assert(std::is_copy_assignable >::value); + static_assert(std::is_destructible >::value); + static_assert(is_equality_comparable >::value); + + static_assert(std::is_trivially_copy_constructible::value == + std::is_trivially_copy_constructible>::value); + static_assert(std::is_trivially_copy_assignable::value == + std::is_trivially_copy_assignable>::value); + static_assert(std::is_trivially_destructible::value == + std::is_trivially_destructible>::value); +} + +struct Foo { }; + +int main(int, char**) +{ + test_traits(); + test_traits(); + test_traits(); // TODO: what other types should I add? + + // Position type requirements table 106 (in order): + + std::streampos p1(42); + std::streamoff o1(p1); + + { + assert(o1 == 42); + } + { + std::streampos p2(42); + std::streampos q1(43); + std::streampos const p3(44); + std::streampos const q2(45); + assert(p2 != q1); + assert(p3 != q2); + assert(p2 != q2); + assert(p3 != q1); + } + { + std::streampos p2 = p1 + o1; + assert(p2 == 84); + } + { + std::streampos& p2 = p1 += o1; + assert(p2 == 84); + assert(p1 == 84); + } + { + std::streampos p2 = p1 - o1; + assert(p2 == 42); + } + { + std::streampos& p2 = p1 -= o1; + assert(p2 == 42); + assert(p1 == 42); + } + { + std::streampos p2 = o1 + p1; + assert(p2 == 84); + } + { + std::streampos q1(42); + std::streamoff o2 = q1 - p1; + assert(o2 == 0); + } + + return 0; +} Index: www/cxx2a_status.html =================================================================== --- www/cxx2a_status.html +++ www/cxx2a_status.html @@ -93,7 +93,7 @@ P0646R1LWGImproving the Return Value of Erase-Like AlgorithmsRapperswil P0722R3CWGEfficient sized delete for variable sized classesRapperswil P0758R1LWGImplicit conversion traits and utility functionsRapperswilComplete - P0759R1LWGfpos RequirementsRapperswil + P0759R1LWGfpos RequirementsRapperswilComplete P0769R2LWGAdd shift to <algorithm>Rapperswil P0788R3LWGStandard Library Specification in a Concepts and Contracts WorldRapperswil P0879R0LWGConstexpr for swap and swap related functions Also resolves LWG issue 2800.Rapperswil