Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / optmove.cxx
blob976806772f7e202e81643be399ab015384142960
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 */
9 #include "config_clang.h"
10 #include <vector>
12 namespace test1
14 void foo1(std::vector<int> x)
16 std::vector<int> y;
17 // expected-error@+1 {{can std::move value instead of copy [loplugin:optmove]}}
18 y = x;
22 namespace test2
24 void foo(std::vector<int> x)
26 // expected-error@+1 {{can std::move value instead of copy [loplugin:optmove]}}
27 std::vector<int> y = x;
31 namespace test3
33 void foo1(std::vector<int> x)
35 std::vector<int> y, z;
36 y = x;
37 // expected-error@+1 {{can std::move value instead of copy [loplugin:optmove]}}
38 z = x;
42 namespace test4
44 void foo1(std::vector<int> x)
46 std::vector<int> y;
47 // no warning expected, don't even try to follow loop
48 for (int i = 0; i < 10; i++)
49 y = x;
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */