Tinderbox failure, Linux-F19-x86_64 at 14-with-check, MASTER, last success: 2015-09-08 12:32:12
Stephan Bergmann
sbergman at redhat.com
Thu Sep 10 03:43:23 PDT 2015
On 09/10/2015 12:11 PM, Eike Rathke wrote:
> On Wednesday, 2015-09-09 07:17:47 +0000, stephan.bergmann.tinderbox at googlemail.com wrote:
>
>> /home/tinderbox/master/sc/qa/unit/ucalc_formula.cxx:5599:41: error: elide construction of rtl::OUString with string constant argument in call of rtl::operator+ [loplugin:stringconstant]
>> CPPUNIT_ASSERT_EQUAL( aPrefix + OUString("448"), aPrefix + m_pDoc->GetString( aPos));
>
> That's funny, because I tried without the ctor first and it didn't
> compile.. I guess the cppunit type deduction gets in the way there.
Yeah, that one is somewhat funny (aPrefix and m_pDoc->GetString(aPos)
both being of type OUString, too):
* OUString + OUString returns a OUStringConcat<OUString, OUString> (at
least in LIBO_INTERNAL_ONLY)
* OUString + "literal" returns some OUStringConcat<OUString, char const[N]>
* CPPUNIT_ASSERT_EQUAL(a, b), somewhat unfortunately, requires a and b
to be of the same type (and ultimately calls "a == b")
So CPPUNIT_ASSERT_EQUAL(OUString+OUString, OUString+OUString) happens to
compile (and does the right thing, as OUString+OUString ==
OUString+OUString will use the implicit OUString(OUStringConcat)
conversion ctor to end up as OUString == OUString).
But CPPUNIT_ASSERT_EQUAL(OUString+"literal", OUString+OUString) fails to
compile due to two different types being passed to CPPUNIT_ASSERT_EQUAL.
(What fixes it and still works around the---somewhat unhelpful in this
specific case, but often useful---loplugin::stringconstant warning, is
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=e4757b79e2938e48a57d129413df3f06bf638b4d>
"WaE: loplugin:stringconstant.")
More information about the LibreOffice
mailing list