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/.
11 #include <rtl/ustring.hxx>
20 foo(x
= 2); // expected-error {{buried assignment, very hard to read [loplugin:buriedassign]}}
21 int y
= x
= 1; // no warning expected
24 x
= 1); // expected-error {{buried assignment, very hard to read [loplugin:buriedassign]}}
27 { // expected-error@-1 {{buried assignment, very hard to read [loplugin:buriedassign]}}
29 std::map
<int, int> map1
;
31 = 1; // expected-error@-1 {{buried assignment, very hard to read [loplugin:buriedassign]}}
44 MyInt
& operator=(MyInt
const&) = default;
45 MyInt
& operator=(int) { return *this; }
46 bool operator<(MyInt
const& other
) const { return x
< other
.x
; }
54 foo(x
= 2); // expected-error {{buried assignment, very hard to read [loplugin:buriedassign]}}
55 MyInt y
= x
= 1; // no warning expected
58 x
= 1); // expected-error {{buried assignment, very hard to read [loplugin:buriedassign]}}
60 z
= x
; // no warning expected
61 std::map
<MyInt
, int> map1
;
63 = 1; // expected-error@-1 {{buried assignment, very hard to read [loplugin:buriedassign]}}
69 void main(OUString sUserAutoCorrFile
, OUString sExt
)
72 if (sUserAutoCorrFile
== "xxx")
73 sRet
= sUserAutoCorrFile
; // no warning expected
74 if (sUserAutoCorrFile
== "yyy")
75 (sRet
= sUserAutoCorrFile
)
76 += sExt
; // expected-error@-1 {{buried assignment, very hard to read [loplugin:buriedassign]}}
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */