1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10 #include <sal/config.h>
11
12 #include <rtl/ustring.hxx>
13
f(OUString s,bool b)14 void f(OUString s, bool b)
15 {
16 // expected-error@+2 {{replace 2nd operand of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}}
17 // expected-note@+1 {{conditional expression is here [loplugin:conditionalstring]}}
18 s += (b ? OUString("a") : throw 0);
19 // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}}
20 b = (b ? ("x") : (OUString(("y")))) == s;
21 // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}}
22 b = operator==(s, b ? OUString("x") : OUString("y"));
23 // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}}
24 s.operator+=(b ? OUString("x") : OUString("y"));
25 }
26
27 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
28