string_view.fail.cpp 705 B

123456789101112131415161718192021222324
  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. // <string>
  9. // explicit basic_string(basic_string_view<CharT, traits> sv, const Allocator& a = Allocator());
  10. #include <string>
  11. #include <string_view>
  12. void foo ( const string &s ) {}
  13. int main(int, char**)
  14. {
  15. std::string_view sv = "ABCDE";
  16. foo(sv); // requires implicit conversion from string_view to string
  17. return 0;
  18. }