io.fail.cpp (1042B)
1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03 11 // Because we don't have a functioning decltype in C++03 12 13 // <memory> 14 15 // unique_ptr 16 17 // template<class CharT, class Traits, class Y, class D> 18 // basic_ostream<CharT, Traits>& 19 // operator<<(basic_ostream<CharT, Traits>& os, const unique_ptr<Y, D>& p); 20 21 // -?- Remarks: This function shall not participate in overload resolution unless os << p.get() is a valid expression. 22 23 #include <memory> 24 #include <sstream> 25 #include <cassert> 26 27 #include "min_allocator.h" 28 #include "deleter_types.h" 29 30 int main() 31 { 32 std::unique_ptr<int, PointerDeleter<int>> p; 33 std::ostringstream os; 34 os << p; // expected-error {{invalid operands to binary expression}} 35 }