nss: upgrade to release 3.73
[LibreOffice.git] / compilerplugins / clang / test / stringconcatauto.cxx
blob8318e3c4a26f7248926362022fda39839c502293
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * Based on LLVM/Clang.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
12 #include <rtl/ustring.hxx>
14 void foo()
16 auto str1 = "str1" + OUString::number(10);
17 // expected-error-re@-1 {{creating a variable of type 'rtl::OUStringConcat<{{.*}}>' will make it reference temporaries}}
18 // expected-note@-2 {{use OUString instead}}
19 OUString str2 = "str2" + OUString::number(20) + "ing";
20 const auto& str3 = "str3" + OUString::number(30);
21 // expected-error-re@-1 {{creating a variable of type 'const rtl::OUStringConcat<{{.*}}> &' will make it reference temporaries}}
22 // expected-note@-2 {{use OUString instead}}
23 const auto str4 = "str4" + OString::number(40);
24 // expected-error-re@-1 {{creating a variable of type 'const rtl::OStringConcat<{{.*}}>' will make it reference temporaries}}
25 // expected-note@-2 {{use OString instead}}
26 auto str5 = OUString::number(50);
27 // expected-error-re@-1 {{creating a variable of type 'rtl::OUStringNumber<{{.*}}>' will make it reference temporaries}}
28 // expected-note@-2 {{use OUString instead}}
29 (void)str1;
30 (void)str2;
31 (void)str3;
32 (void)str4;
33 (void)str5;
36 struct A
38 auto bar()
39 // expected-error-re@-1 {{returning a variable of type 'rtl::OStringConcat<{{.*}}>' will make it reference temporaries}}
40 // expected-note@-2 {{use OString instead}}
42 return "bar" + OString::number(110);
44 auto baz()
45 // expected-error-re@-1 {{returning a variable of type 'rtl::OStringNumber<{{.*}}>' will make it reference temporaries}}
46 // expected-note@-2 {{use OString instead}}
48 return OString::number(120);
52 template <typename T> void fun(const T& par)
53 // parameters are without warnings
55 const T& var = par;
56 // expected-error-re@-1 {{creating a variable of type 'const rtl::OUStringConcat<{{.*}}> &' will make it reference temporaries}}
57 // expected-note@-2 {{use OUString instead}}
58 (void)var;
61 void testfun() { fun("fun" + OUString::number(200)); }
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */