[clang] Fix crashes when passing VLA to va_arg (#119563)
[llvm-project.git] / libcxx / test / std / strings / string.view / string.view.io / stream_insert_decl_present.compile.pass.cpp
blob6f39ade8c8984528fcc3f0a56078794ae6205113
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: !stdlib=libc++ && (c++03 || c++11 || c++14)
11 // <string_view>
13 // template<class charT, class traits, class Allocator>
14 // basic_ostream<charT, traits>&
15 // operator<<(basic_ostream<charT, traits>& os,
16 // const basic_string_view<charT,traits> str);
18 #include <iosfwd>
19 #include <string_view>
20 #include <utility>
22 template <class SV, class = void>
23 struct HasDecl : std::false_type {};
24 template <class SV>
25 struct HasDecl<SV, decltype(static_cast<void>(std::declval<std::ostream&>() << std::declval<SV&>()))> : std::true_type {
28 static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present");