File: udlit-resolve-char8_t.C

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (38 lines) | stat: -rw-r--r-- 1,401 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// { dg-options "-std=c++17 -fchar8_t" }

#include <cstdint>
#include <cassert>

int operator"" _foo(const char*)                  { return 0; }
int operator"" _foo(unsigned long long int)       { return 1; }
int operator"" _foo(long double)                  { return 2; }
int operator"" _foo(char)                         { return 3; }
int operator"" _foo(wchar_t)                      { return 4; }
int operator"" _foo(char8_t)                      { return 5; }
int operator"" _foo(char16_t)                     { return 6; }
int operator"" _foo(char32_t)                     { return 7; }
int operator"" _foo(const char*, std::size_t)     { return 8; }
int operator"" _foo(const wchar_t*, std::size_t)  { return 9; }
int operator"" _foo(const char8_t*, std::size_t)  { return 10; }
int operator"" _foo(const char16_t*, std::size_t) { return 11; }
int operator"" _foo(const char32_t*, std::size_t) { return 12; }
template<char...> int operator"" _foo2()          { return 20; }
int operator"" _foo2(unsigned long long int)      { return 21; }

int
main()
{
  assert(123_foo == 1);
  assert(0.123_foo == 2);
  assert('c'_foo == 3);
  assert(L'c'_foo == 4);
  assert(u8'c'_foo == 5);
  assert(u'c'_foo == 6);
  assert(U'c'_foo == 7);
  assert("abc"_foo == 8);
  assert(L"abc"_foo == 9);
  assert(u8"abc"_foo == 10);
  assert(u"abc"_foo == 11);
  assert(U"abc"_foo == 12);
  assert(123_foo2 == 21);
}