]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/align/2.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / align / 2.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
01d6452f 2
8d9254fc 3// Copyright (C) 2014-2020 Free Software Foundation, Inc.
01d6452f
JW
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the terms
7// of the GNU General Public License as published by the Free Software
8// Foundation; either version 3, or (at your option) any later
9// version.
10
11// This library is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
19
20// C++11 [ptr.align] (20.6.5): std::align
21
22#include <memory>
23#include <testsuite_hooks.h>
24
25void
26test01()
27{
01d6452f
JW
28 int i = 0;
29 void* ptr = &i;
30 auto space = sizeof(i);
4ed6e524 31 auto p2 = std::align(alignof(int), space, ptr, space);
01d6452f
JW
32 VERIFY( ptr == &i );
33 VERIFY( p2 == &i );
34 VERIFY(space == sizeof(i));
35}
36
37int main()
38{
39 test01();
40}