xref: /llvm-project/libcxx/test/std/strings/string.view/string_view.literals/literal.verify.cpp (revision 4fc502368ad002e5b8deff87288eb0627f3e6bec)
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 
9 // Note: libc++ supports string_view before C++17, but literals were introduced in C++14
10 // UNSUPPORTED: c++03, c++11
11 // UNSUPPORTED: !stdlib=libc++ && c++14
12 
13 #include <string_view>
14 
f()15 void f() {
16   {
17     using std::string_view;
18     string_view foo = ""sv; // expected-error {{no matching literal operator}}
19   }
20   {
21     std::string_view foo = ""sv; // expected-error {{no matching literal operator}}
22   }
23 }
24