]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/align/3.cc
1 // { dg-do run { target c++11 } }
3 // 2020-09-20 Glen Joseph Fernandes <glenjofe@gmail.com>
5 // Copyright (C) 2020-2021 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the terms
9 // of the GNU General Public License as published by the Free Software
10 // Foundation; either version 3, or (at your option) any later
13 // This library is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // C++11 [ptr.align] (20.6.5): std::align
25 #include <testsuite_hooks.h>
29 void* p1
= reinterpret_cast<void*>(5);
31 std::size_t s1
= 3072;
33 VERIFY(std::align(1024, static_cast<std::size_t>(-1), p1
, s1
) == nullptr);
40 void* p1
= reinterpret_cast<void*>(1);
44 VERIFY(std::align(2, static_cast<std::size_t>(-1), p1
, s1
) == nullptr);