String literals, ASCII vs UTF-8

Stephan Bergmann sbergman at
Tue Feb 28 05:39:03 PST 2012

On 02/28/2012 12:30 PM, Lubos Lunak wrote:
>   The reason for this is that I have patches adding more functions taking
> string literals and there it makes much more sense to require only ASCII. For
> example OUString::operator== can be simply a call to OUString::equalsAsciiL()
> for ASCII, but for UTF-8 it requires a conversion and unicode comparison.


> PS: Any idea why ' OUString foo() { return "foo";} ' does not work, even
> though the ctor is not explicit? I can't recall a reason why a return value
> would need to be different from the other cases.

Looks like a GCC error to me.

   struct S { S(char const (&)[2]); };
   S f() { return "a"; }

compiles just fine with recent Clang and 
<>, but fails with

   could not convert ‘(const char*)"a"’ from ‘const char*’ to ‘S’

on GCC.


More information about the LibreOffice mailing list