36 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <iomanip>10 11// quoted12 13// UNSUPPORTED: c++03, c++1114 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 21template <class charT>22struct test_traits {23 typedef charT char_type;24};25 26void 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 33void f() {34 round_trip("Hi Mom");35}36