[llvm-bugs] [Bug 40549] New: ClangCL can't use UDL with /std:c++latest

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 31 09:43:14 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40549

            Bug ID: 40549
           Summary: ClangCL can't use UDL with /std:c++latest
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190131/6d3ef721/attachment.html>


More information about the llvm-bugs mailing list