]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/align/2.cc
testsuite_hooks.h: Rewrite VERIFY in terms of __builtin_printf and __builtin_abort.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / align / 2.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
01d6452f 2
818ab71a 3// Copyright (C) 2014-2016 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
facb4d1b
JW
22// { dg-require-cstdint "" }
23
01d6452f
JW
24#include <memory>
25#include <testsuite_hooks.h>
26
27void
28test01()
29{
01d6452f
JW
30 int i = 0;
31 void* ptr = &i;
32 auto space = sizeof(i);
4ed6e524 33 auto p2 = std::align(alignof(int), space, ptr, space);
01d6452f
JW
34 VERIFY( ptr == &i );
35 VERIFY( p2 == &i );
36 VERIFY(space == sizeof(i));
37}
38
39int main()
40{
41 test01();
42}