<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 - ClangCL can't use UDL with /std:c++latest"
   href="https://bugs.llvm.org/show_bug.cgi?id=40549">40549</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ClangCL can't use UDL with /std:c++latest
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This occurs while trying to implement a user-defined literal. Attempting to
compile code without char8_t and with

 A a2 = u8"\u4F60\u597D"_sv;

results in 

u8.cpp(24,28):  error: no matching literal operator for call to 'operator""_sv'
with arguments of types
      'const char8_t *' and 'unsigned long long', and no matching literal
operator template
    A a2 = u8"\u4F60\u597D"_sv;

Trying to add an overload with char8_t results in:

u8.cpp(10,1):  error: cannot mangle this built-in char8_t type yet
A operator "" _sv(const char8_t* str, INT len)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


So, currently UDL can't be used with /std:c++latest


struct A
{
  A()  {}
};

#define INT unsigned long long

#ifdef TRY_U8
A operator "" _sv(const char8_t* str, INT len)
{
    return A{};
}
#endif 

A operator "" _sv(const char* str, INT len)
{
    return A{};
}

int main()
{
    A a1 = "hello"_sv;
#ifdef TRY_U8
    A a2 = u8"\u4F60\u597D"_sv;
#endif
}</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>