(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
raw-string-1.c
       1  // { dg-do run }
       2  // { dg-require-effective-target wchar }
       3  // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
       4  // { dg-options "-std=c++0x" { target c++ } }
       5  
       6  #ifndef __cplusplus
       7  #include <wchar.h>
       8  
       9  typedef __CHAR16_TYPE__	char16_t;
      10  typedef __CHAR32_TYPE__ char32_t;
      11  #endif
      12  
      13  const char s0[] = R"(a\
      14  \u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
      15  c)";
      16  const char s1[] = "a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
      17  const char s2[] = R"*|*(a\
      18  b
      19  c)"
      20  c)*|"
      21  c)*|*";
      22  const char s3[] = "a\\\nb\nc)\"\nc)*|\"\nc";
      23  // The ) in ??) below is part of the raw string suffix )".
      24  const char s4[] = R"(??/
      25  ??/
      26  ??(??<??=??'??!??-??>??)";
      27  const char s5[] = "?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
      28  
      29  const char t0[] = u8R"(a\
      30  \u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
      31  c)";
      32  const char t1[] = u8"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
      33  const char t2[] = u8R"*|*(a\
      34  b
      35  c)"
      36  c)*|"
      37  c)*|*";
      38  const char t3[] = u8"a\\\nb\nc)\"\nc)*|\"\nc";
      39  const char t4[] = u8R"(??/
      40  ??/
      41  ??(??<??=??'??!??-??>??)";
      42  const char t5[] = u8"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
      43  
      44  const char16_t u0[] = uR"(a\
      45  \u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
      46  c)";
      47  const char16_t u1[] = u"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
      48  const char16_t u2[] = uR"*|*(a\
      49  b
      50  c)"
      51  c)*|"
      52  c)*|*";
      53  const char16_t u3[] = u"a\\\nb\nc)\"\nc)*|\"\nc";
      54  const char16_t u4[] = uR"(??/
      55  ??/
      56  ??(??<??=??'??!??-??>??)";
      57  const char16_t u5[] = u"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
      58  
      59  const char32_t U0[] = UR"(a\
      60  \u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
      61  c)";
      62  const char32_t U1[] = U"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
      63  const char32_t U2[] = UR"*|*(a\
      64  b
      65  c)"
      66  c)*|"
      67  c)*|*";
      68  const char32_t U3[] = U"a\\\nb\nc)\"\nc)*|\"\nc";
      69  const char32_t U4[] = UR"(??/
      70  ??/
      71  ??(??<??=??'??!??-??>??)";
      72  const char32_t U5[] = U"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
      73  
      74  const wchar_t L0[] = LR"(a\
      75  \u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
      76  c)";
      77  const wchar_t L1[] = L"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
      78  const wchar_t L2[] = LR"*|*(a\
      79  b
      80  c)"
      81  c)*|"
      82  c)*|*";
      83  const wchar_t L3[] = L"a\\\nb\nc)\"\nc)*|\"\nc";
      84  const wchar_t L4[] = LR"(??/
      85  ??/
      86  ??(??<??=??'??!??-??>??)";
      87  const wchar_t L5[] = L"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
      88  
      89  int
      90  main (void)
      91  {
      92    if (sizeof (s0) != sizeof (s1)
      93        || __builtin_memcmp (s0, s1, sizeof (s0)) != 0)
      94      __builtin_abort ();
      95    if (sizeof (s2) != sizeof (s3)
      96        || __builtin_memcmp (s2, s3, sizeof (s2)) != 0)
      97      __builtin_abort ();
      98    if (sizeof (s4) != sizeof (s5)
      99        || __builtin_memcmp (s4, s5, sizeof (s4)) != 0)
     100      __builtin_abort ();
     101    if (sizeof (t0) != sizeof (t1)
     102        || __builtin_memcmp (t0, t1, sizeof (t0)) != 0)
     103      __builtin_abort ();
     104    if (sizeof (t2) != sizeof (t3)
     105        || __builtin_memcmp (t2, t3, sizeof (t2)) != 0)
     106      __builtin_abort ();
     107    if (sizeof (t4) != sizeof (t5)
     108        || __builtin_memcmp (t4, t5, sizeof (t4)) != 0)
     109      __builtin_abort ();
     110    if (sizeof (u0) != sizeof (u1)
     111        || __builtin_memcmp (u0, u1, sizeof (u0)) != 0)
     112      __builtin_abort ();
     113    if (sizeof (u2) != sizeof (u3)
     114        || __builtin_memcmp (u2, u3, sizeof (u2)) != 0)
     115      __builtin_abort ();
     116    if (sizeof (u4) != sizeof (u5)
     117        || __builtin_memcmp (u4, u5, sizeof (u4)) != 0)
     118      __builtin_abort ();
     119    if (sizeof (U0) != sizeof (U1)
     120        || __builtin_memcmp (U0, U1, sizeof (U0)) != 0)
     121      __builtin_abort ();
     122    if (sizeof (U2) != sizeof (U3)
     123        || __builtin_memcmp (U2, U3, sizeof (U2)) != 0)
     124      __builtin_abort ();
     125    if (sizeof (U4) != sizeof (U5)
     126        || __builtin_memcmp (U4, U5, sizeof (U4)) != 0)
     127      __builtin_abort ();
     128    if (sizeof (L0) != sizeof (L1)
     129        || __builtin_memcmp (L0, L1, sizeof (L0)) != 0)
     130      __builtin_abort ();
     131    if (sizeof (L2) != sizeof (L3)
     132        || __builtin_memcmp (L2, L3, sizeof (L2)) != 0)
     133      __builtin_abort ();
     134    if (sizeof (L4) != sizeof (L5)
     135        || __builtin_memcmp (L4, L5, sizeof (L4)) != 0)
     136      __builtin_abort ();
     137    if (sizeof (R"*()*") != 1
     138        || __builtin_memcmp (R"*()*", "", 1) != 0)
     139      __builtin_abort ();
     140    return 0;
     141  }