gcc/libstdc++-v3/testsuite/20_util/pair/44487.cc
Paolo Carlini 87b2e74657 re PR libstdc++/44487 ([C++0x] pair of references doesn't work)
2010-06-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/44487
	* include/bits/stl_pair.h (pair(pair&&)): Remove.
	(pair(pair<_U1, _U2>&&): Use forward, consistently with Bullet 5
	of LWG 1326.
	* include/std/tuple (tuple(pair<_U1, _U2>&&)): Likewise.
	* testsuite/20_util/pair/44487.cc: Add.
	* testsuite/20_util/tuple/cons/44487.cc: Likewise.
	* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
	line numbers.

From-SVN: r160528
2010-06-10 10:24:46 +00:00

52 lines
1.2 KiB
C++

// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <utility>
int x, y;
std::pair<int&, int&>
foo1()
{
std::pair<int&, int&> blah(x, y);
return blah;
}
std::pair<int&, int&>
foo2()
{
const std::pair<int&, int&> blah(x, y);
return blah;
}
std::pair<int&, int&>
foo3()
{
std::pair<int&, int&> blah(x, y);
return std::pair<int&, int&>(std::move(blah));
}
std::pair<int&, int&>
foo4()
{
const std::pair<int&, int&> blah(x, y);
return std::pair<int&, int&>(std::move(blah));
}