Index: include/ostream =================================================================== --- include/ostream +++ include/ostream @@ -1044,18 +1044,13 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template +template inline _LIBCPP_INLINE_VISIBILITY -typename enable_if -< - !is_lvalue_reference<_Stream>::value && - is_base_of::value, - _Stream&& ->::type -operator<<(_Stream&& __os, const _Tp& __x) +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits> && __os, const _Tp& __x) { __os << __x; - return _VSTD::move(__os); + return __os; } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES Index: test/input.output/iostream.format/output.streams/ostream.rvalue/return_value.pass.cpp =================================================================== --- /dev/null +++ test/input.output/iostream.format/output.streams/ostream.rvalue/return_value.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_ostream; + +// template +// basic_ostream& +// operator<<(basic_ostream&& os, const T& x); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + { + typedef decltype(std::ostream(nullptr) << "testing...") T; + static_assert(std::is_same::value, "must be lvalue"); + } + { + typedef decltype(std::wostream(nullptr) << "testing...") T; + static_assert(std::is_same::value, "must be lvalue"); + } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +}