bump product version to 6.4.0.3
[LibreOffice.git] / compilerplugins / clang / test / constfields.cxx
blobc045396d54320c4da320bf6f6a0bb8d683eb0582
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>
11 #include <ostream>
12 #include <com/sun/star/uno/Any.hxx>
14 struct Test0
16 void method1() {}
19 // checking for calling non-const method
20 struct Test1
21 // expected-error@-1 {{notconst m_field1 [loplugin:constfields]}}
23 Test0* m_field1;
25 void method1()
27 if (m_field1)
28 m_field1->method1();
32 // checking for assigning to field
33 struct Test2
34 // expected-error@-1 {{notconst m_field1 [loplugin:constfields]}}
36 Test0* m_field1;
38 Test2()
39 : m_field1(nullptr)
43 void method1() { m_field1 = nullptr; }
45 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */