xref: /llvm-project/libcxx/test/std/input.output/iostream.format/quoted.manip/quoted_char.verify.cpp (revision 72f0edf3f4291d2614719a8c8af21a7a62ed5d74)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <iomanip>
10 
11 // quoted
12 
13 // UNSUPPORTED: c++03, c++11
14 // XFAIL: no-wide-characters
15 
16 #include <iomanip>
17 #include <sstream>
18 #include <string>
19 
20 //  Test that mismatches between strings and wide streams are diagnosed
21 
round_trip(const char * p)22 void round_trip ( const char *p ) {
23     std::wstringstream ss;
24     ss << std::quoted(p); // expected-error {{invalid operands to binary expression}}
25     std::string s;
26     ss >> std::quoted(s); // expected-error {{invalid operands to binary expression}}
27 }
28 
f()29 void f() {
30     round_trip("Hi Mom");
31 }
32