Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / rangedforcopy.cxx
blobe9a836e2489cf3b21048cedea66b30ec859e8827
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.
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 */
10 #include <vector>
12 struct S
14 int i1;
15 int i2;
18 void f(S const (&a)[2])
20 // expected-error-re@+1 {{Loop variable passed by value, pass by reference instead, e.g. 'const {{(struct )?}}S&' [loplugin:rangedforcopy]}}
21 for (auto i : a)
23 (void)i;
25 for (auto[i1, i2] : a)
27 (void)i1;
28 (void)i2;
32 void f(std::vector<bool> const& v)
34 for (auto b : v)
36 (void)b;
40 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */