summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/21_strings/basic_string/literals/constexpr.cc
blob: c2b54f15fc425873200d35cae9d617a5684c8f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// { dg-do compile { target c++20 } }
// { dg-require-effective-target cxx11_abi }

#include <string>
#include <testsuite_hooks.h>

constexpr bool
test_literals()
{
  using namespace std::literals;

  auto s = "narrow string"s;
  auto sw = L"wide string"s;
  auto s8 = u8"UTF-8 string"s;
  auto su = u"UTF-16 string"s;
  auto sU = U"UTF-32 string"s;

  return !s.empty() && !sw.empty() && !s8.empty() && !su.empty() && !sU.empty();
}

static_assert( test_literals() );