150276Speter// 2002-01-24 Phil Edwards <pme@gcc.gnu.org> 2166124Srafan 350276Speter// Copyright (C) 2002-2015 Free Software Foundation, Inc. 450276Speter// 550276Speter// This file is part of the GNU ISO C++ Library. This library is free 650276Speter// software; you can redistribute it and/or modify it under the 750276Speter// terms of the GNU General Public License as published by the 850276Speter// Free Software Foundation; either version 3, or (at your option) 950276Speter// any later version. 1050276Speter 1150276Speter// This library is distributed in the hope that it will be useful, 1250276Speter// but WITHOUT ANY WARRANTY; without even the implied warranty of 1350276Speter// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1450276Speter// GNU General Public License for more details. 1550276Speter 1650276Speter// You should have received a copy of the GNU General Public License along 1750276Speter// with this library; see the file COPYING3. If not see 1850276Speter// <http://www.gnu.org/licenses/>. 1950276Speter 2050276Speter// 20.4.3 temporary buffers 2150276Speter 2250276Speter#include <memory> 2350276Speter#include <testsuite_hooks.h> 2450276Speter 2550276Speterstruct junk { char j[12]; }; 2650276Speter 2750276Speterint main(void) 2850276Speter{ 29174993Srafan bool test __attribute__((unused)) = true; 30174993Srafan 3150276Speter typedef std::pair<junk*, std::ptrdiff_t> pair_type; 3266963Speter pair_type results = std::get_temporary_buffer<junk>(5); 3350276Speter 3450276Speter if (results.second != 0) 3550276Speter { 3650276Speter // make sure it works: test the returned capacity, and then construct 37166124Srafan // some junk in the buffer. 3850276Speter // XXX 3950276Speter VERIFY( results.first != 0 ); 40166124Srafan } 4150276Speter else 42166124Srafan { 4350276Speter // if it says it didn't work, make sure it didn't work 4450276Speter VERIFY( results.first == 0 ); 45166124Srafan } 4666963Speter 4762449Speter std::return_temporary_buffer(results.first); 4850276Speter 4950276Speter return 0; 50166124Srafan} 5150276Speter