I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere. (Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) ) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339213 91177308-0d34-0410-b5e6-96231b3b80d8
25 lines
640 B
C++
25 lines
640 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// <ios>
|
|
|
|
// template <class charT, class traits> class basic_ios
|
|
|
|
// char narrow(char_type c, char dfault) const;
|
|
|
|
#include <ios>
|
|
#include <cassert>
|
|
|
|
int main()
|
|
{
|
|
const std::wios ios(0);
|
|
assert(ios.narrow(L'c', '*') == 'c');
|
|
assert(ios.narrow(L'\u203C', '*') == '*');
|
|
}
|