literal1.pass.cpp 874 B

12345678910111213141516171819202122232425262728
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // UNSUPPORTED: c++98, c++03, c++11
  10. // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
  11. // UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
  12. // Note: libc++ supports string_view before C++17, but literals were introduced in C++14
  13. #include <string_view>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. int main(int, char**)
  17. {
  18. using namespace std::literals;
  19. std::string_view foo = ""sv;
  20. assert(foo.length() == 0);
  21. return 0;
  22. }