File: udlit-resolve-char8_t.C

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
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);
}