Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / redundantinline.hxx
blob9b1460d587cc334db109aec595196c9fa4cd0d9b
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 #pragma once
12 struct S1 {
13 inline S1();
14 inline ~S1();
17 S1::S1() = default;
19 struct S2 {
20 inline S2() = default; // expected-error {{[loplugin:redundantinline]}}
21 inline ~S2() = default; // expected-error {{[loplugin:redundantinline]}}
24 struct S3 {
25 inline S3();
26 inline ~S3();
28 inline void f1();
30 static inline void f2();
32 inline void operator +();
34 inline operator int();
36 friend inline void f3();
39 S3::S3() {}
41 S3::~S3() { f1(); }
43 void S3::f1() { (void)this; }
45 void S3::f2() {}
47 void S3::operator +() {}
49 void f3() {}
51 S3::operator int() { return 0; }
53 struct S4 {
54 inline S4() {} // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
55 inline ~S4() { f1(); } // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
57 inline void f1() { (void)this; } // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
59 static inline void f2() {} // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
61 inline void operator +() {} // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
63 inline operator int() { return 0; } // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
65 friend inline void f4() {} // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
67 static constexpr int f5() { return 0; }
69 static constexpr inline int f6() { return 0; } // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
72 constexpr int f5() { return 0; }
74 constexpr inline int f6() { return 0; } // expected-error {{function definition redundantly declared 'inline' [loplugin:redundantinline]}}
76 static inline int f7() { return 0; }
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */