Debian Codegraph @

libcxx/test/std/input.output/iostream.format/quoted.manip/quoted_traits.verify.cpp

raw
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
15 #include <iomanip>
16 #include <sstream>
17 #include <string>
18
19 // Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
20
21 template <class charT>
22 struct test_traits {
23 typedef charT char_type;
24 };
25
26 void round_trip ( const char *p ) {
27 std::stringstream ss;
28 ss << std::quoted(p);
29 std::basic_string<char, test_traits<char>> s;
30 ss >> std::quoted(s); // expected-error {{invalid operands to binary expression}}
31 }
32
33 void f() {
34 round_trip("Hi Mom");
35 }