https://bugs.llvm.org/show_bug.cgi?id=32963

            Bug ID: 32963
           Summary: Incorrect implementation of LWG 2534
           Product: libc++
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: zi...@kayari.org
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com

#include <iostream>

int main()
{
    std::ostream& os = std::move(std::cout) << "http://wg21.link/lwg2534";;
    os << '\n';
}


prog.cc:5:19: error: non-const lvalue reference to type 'basic_ostream<...>'
cannot bind to a temporary of type 'basic_ostream<...>'
    std::ostream& os = std::move(std::cout) << "http://wg21.link/lwg2534";;
                  ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The return type should be an lvalue reference.

The SFINAE constraint on the operator<< for rvalue streams also seem wrong.
This shouldn't compile because the constraint is not met:

#include <ostream>

struct X : std::ios_base { };
struct Y { };

template<typename T, typename U, typename = void>
  struct is_streamable
  : std::false_type { };

template<typename T, typename U>
  struct is_streamable<T, U, decltype(void(), std::declval<T>() <<
std::declval<U>())>
  : std::true_type { };

static_assert( !is_streamable<X, Y>::value, "" );

decltype(std::declval<X>() << std::declval<Y>()) f();
const auto& ff = f();

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to