[libcxx] r328225 - Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 22 11:27:28 PDT 2018


Author: marshall
Date: Thu Mar 22 11:27:28 2018
New Revision: 328225

URL: http://llvm.org/viewvc/llvm-project?rev=328225&view=rev
Log:
Fix improperly failing test - and the code it was testing. Thanks to Stephan Lavavej for the catch.

Modified:
    libcxx/trunk/include/ostream
    libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp

Modified: libcxx/trunk/include/ostream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ostream?rev=328225&r1=328224&r2=328225&view=diff
==============================================================================
--- libcxx/trunk/include/ostream (original)
+++ libcxx/trunk/include/ostream Thu Mar 22 11:27:28 2018
@@ -1071,19 +1071,17 @@ operator<<(basic_ostream<_CharT, _Traits
     return __os << __p.get();
 }
 
-#ifndef _LIBCPP_HAS_NO_DECLTYPE
 template<class _CharT, class _Traits, class _Yp, class _Dp>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
-    is_same<void, typename __void_t<decltype(declval<basic_ostream<_CharT, _Traits>&>() << declval<_Yp>())>::type>::value,
+    is_same<void, typename __void_t<decltype((declval<basic_ostream<_CharT, _Traits>&>() << declval<typename unique_ptr<_Yp, _Dp>::pointer>()))>::type>::value,
     basic_ostream<_CharT, _Traits>&
 >::type
 operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p)
 {
     return __os << __p.get();
 }
-#endif
 
 template <class _CharT, class _Traits, size_t _Size>
 basic_ostream<_CharT, _Traits>&

Modified: libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp?rev=328225&r1=328224&r2=328225&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.special/io.fail.cpp Thu Mar 22 11:27:28 2018
@@ -24,11 +24,12 @@
 #include <sstream>
 #include <cassert>
 
-class A {};
+#include "min_allocator.h"
+#include "deleter_types.h"
 
 int main()
 {
-    std::unique_ptr<A> p(new A);
+    std::unique_ptr<int, PointerDeleter<int>> p;
     std::ostringstream os;
-    os << p;
+    os << p; // expected-error {{invalid operands to binary expression}}
 }




More information about the cfe-commits mailing list