1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
14 #include <rtl/string.hxx>
15 #include <rtl/ustring.hxx>
17 #pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
18 #pragma clang diagnostic ignored "-Wunused-but-set-variable"
23 void f(std::ostream
& s1
)
25 static constexpr char foo
[] = "foo";
26 static constexpr char16_t foou
[] = u
"foo";
29 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
31 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
33 s1
<< "foo" << OString("foo");
34 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
35 s1
<< "foo" << OString(FOO
);
36 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
37 s1
<< "foo" << OString(foo
);
38 s1
<< "foo" << OUString("foo");
39 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
40 s1
<< "foo" << OUString(FOO
);
41 // expected-error@-1 {{replace '<<' between string literals with juxtaposition}}
42 s1
<< "foo" << OUString(foo
);
44 s2
= "foo" + OString("foo");
45 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
46 s2
= "foo" + OString(FOO
);
47 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
48 s2
= "foo" + OString(foo
);
49 s2
= "foo" + OStringLiteral("foo");
50 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
51 s2
= "foo" + OStringLiteral(FOO
);
52 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
53 s2
= "foo" + OStringLiteral(foo
);
55 s3
= "foo" + OUString("foo");
56 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
57 s3
= "foo" + OUString(FOO
);
58 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
59 s3
= "foo" + OUString(foo
);
60 s3
= "foo" + OUStringLiteral(u
"foo");
61 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
62 s3
= "foo" + OUStringLiteral(FOOu
);
63 // expected-error@-1 {{replace '+' between string literals with juxtaposition}}
64 s3
= "foo" + OUStringLiteral(foou
);
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */