]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/align/2.cc
Use effective-target instead of -std options
[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{
30 bool test __attribute__((unused)) = true;
31
32 int i = 0;
33 void* ptr = &i;
34 auto space = sizeof(i);
4ed6e524 35 auto p2 = std::align(alignof(int), space, ptr, space);
01d6452f
JW
36 VERIFY( ptr == &i );
37 VERIFY( p2 == &i );
38 VERIFY(space == sizeof(i));
39}
40
41int main()
42{
43 test01();
44}