• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <cassert>
19 
20 #include "test_macros.h"
21 
22 //  Test that mismatches in the traits between the quoted object and the dest string are diagnosed.
23 
24 template <class charT>
25 struct test_traits {
26     typedef charT char_type;
27 };
28 
round_trip(const char * p)29 void round_trip ( const char *p ) {
30     std::stringstream ss;
31     ss << std::quoted(p);
32     std::basic_string<char, test_traits<char>> s;
33     ss >> std::quoted(s); // expected-error {{invalid operands to binary expression}}
34 }
35 
main(int,char **)36 int main(int, char**) {
37     round_trip("Hi Mom");
38 }
39