diff options
author | Eric Fiselier <eric@efcs.ca> | 2019-09-25 18:56:54 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2019-09-25 18:56:54 +0000 |
commit | af4a29af0179995a9d639af45d2c7bacab61f2b0 (patch) | |
tree | 4004b7362f2faccf8a22fab6223243879144d2db /libcxx/test/std/strings | |
parent | 374c04e25733e2a5e07c8151bb6ead71ceab528f (diff) | |
download | bcm5719-llvm-af4a29af0179995a9d639af45d2c7bacab61f2b0.tar.gz bcm5719-llvm-af4a29af0179995a9d639af45d2c7bacab61f2b0.zip |
Add forward declaration of operator<< in <string_view> as required.
This declaration was previously missing despite appearing in the
synopsis. Users are still required to include <ostream> to get the
definition of the streaming operator.
llvm-svn: 372909
Diffstat (limited to 'libcxx/test/std/strings')
-rw-r--r-- | libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp b/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp new file mode 100644 index 00000000000..be0567a7372 --- /dev/null +++ b/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// <string> + +// template<class charT, class traits, class Allocator> +// basic_ostream<charT, traits>& +// operator<<(basic_ostream<charT, traits>& os, +// const basic_string_view<charT,traits> str); + +#include <string_view> +#include <iosfwd> + +template <class SV, class = void> +struct HasDecl : std::false_type {}; +template <class SV> +struct HasDecl<SV, decltype(static_cast<void>(std::declval<std::ostream&>() << std::declval<SV&>()))> : std::true_type {}; + +int main() { + static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present"); +} |