summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-07-31 22:26:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-07-31 22:26:42 -0400
commite7f1930f9411e6fcee99f832a5a16c74cd6740c6 (patch)
tree835681f433a68776c98b51aa17db749656db573d /libstdc++-v3/testsuite/27_io
parent4c65085391c06df2a7b1acb4767e63aee6763d2c (diff)
downloadgcc-e7f1930f9411e6fcee99f832a5a16c74cd6740c6.tar.gz
call.c (convert_class_to_reference): Binding an lvalue to an rvalue reference is bad.
* call.c (convert_class_to_reference): Binding an lvalue to an rvalue reference is bad. If the user-defined conversion is bad, set bad_p before merging conversions. (maybe_handle_ref_bind): Don't push down bad_p. (reference_binding): Binding an lvalue to an rvalue reference is bad. (convert_like_real): Give a helpful error about binding lvalue to rvalue reference. (reference_related_p): No longer static. * typeck.c (build_typed_address): New. (build_static_cast_1): Add static_cast from lvalue to &&. * cp-tree.h: Adjust. * include/bits/move.h (forward): Implement as in N2835. (move): Implement as in N2831. * include/std/istream (rvalue stream operator>>): New. * include/std/ostream (rvalue stream operator<<): New. Co-Authored-By: Douglas Gregor <doug.gregor@gmail.com> From-SVN: r150327
Diffstat (limited to 'libstdc++-v3/testsuite/27_io')
-rw-r--r--libstdc++-v3/testsuite/27_io/rvalue_streams.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/rvalue_streams.cc b/libstdc++-v3/testsuite/27_io/rvalue_streams.cc
new file mode 100644
index 00000000000..b3cc630edc0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/rvalue_streams.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// { dg-do run }
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ int i = 1742;
+ // This usage isn't supported by the current draft.
+ // std::string result = (std::ostringstream() << i).str();
+ std::ostringstream() << i;
+ std::string result ("1742");
+ int i2;
+ std::istringstream(result) >> i2;
+ VERIFY (i == i2);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}