| 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 | |
| 22 | void round_trip ( const char *p ) { |
| 23 | std::wstringstream ss; |
| 24 | ss << std::quoted(string: p); // expected-error {{invalid operands to binary expression}} |
| 25 | std::string s; |
| 26 | ss >> std::quoted(string&: s); // expected-error {{invalid operands to binary expression}} |
| 27 | } |
| 28 | |
| 29 | void f() { |
| 30 | round_trip(p: "Hi Mom" ); |
| 31 | } |
| 32 | |