<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - u8 character literal prefix in C"
   href="https://bugs.llvm.org/show_bug.cgi?id=38582">38582</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>u8 character literal prefix in C
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Bumblebritches57@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm using Xcode 10 Beta 5, AND Xcode 9.3.1, so I'm not sure what version of
clang I'm using because Apple's version numbers are different from the rest of
the LLVM projects version numbers.

This problem has been ongoing.

C11 and C17 both support using u8'X' (or u8'\uXXXX' or u8'\UXXXXXXXX') as
character literal prefixes to specify that the literal should be encoded as
UTF-8.

Don't get me wrong, u8"X", u8"\uXXXX", and u8"\UXXXXXXXX" STRING literals work
fine, but character literals do not.

Here's an example program for you to test:

    #include <stdio.h>
    #include <stdint.h>

    int main(int argc, const char * argv[]) {
        uint8_t UTF8CharacterLiteral   = u8'X';
        uint8_t UTF8Hex4Literal        = u8'\u0304';
        uint8_t UTF8Hex8Literal        = u8'\U00000304';
        printf("UTF-8 Literals: %c, %c, %c", UTF8CharacterLiteral,
UTF8Hex4Literal, UTF8Hex8Literal);

        uint16_t UTF16CharacterLiteral = u'X';
        uint16_t UTF16Hex4Literal      = u'\u0304';
        uint16_t UTF16Hex8Literal      = u'\U00000304';
        printf("UTF-16 Literals: %c, %c, %c", UTF16CharacterLiteral,
UTF16Hex4Literal, UTF16Hex8Literal);

        uint32_t UTF32CharacterLiteral = U'X';
        uint32_t UTF32Hex4Literal      = U'\u0304';
        uint32_t UTF32Hex8Literal      = U'\U00000304';
        printf("UTF-32 Literals: %c, %c, %c", UTF32CharacterLiteral,
UTF32Hex4Literal, UTF32Hex8Literal);
        return 0;
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>