bump product version to 6.3.0.0.beta1
[LibreOffice.git] / compilerplugins / clang / test / simplifydynamiccast.cxx
blob111734f0a51117f12d3738dfe3bae8bce0d15f24
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 struct ClassA
12 virtual ~ClassA() {}
15 struct ClassB : public ClassA
17 void foo() {}
20 void f1(ClassA* p1)
22 if (dynamic_cast<ClassB*>(p1)) // expected-note {{if here [loplugin:simplifydynamiccast]}}
24 static_cast<ClassB*>(p1)
25 ->foo(); // expected-error@-1 {{simplify, use var in if [loplugin:simplifydynamiccast]}}
27 if (dynamic_cast<ClassB*>(p1) != nullptr)
28 { // expected-note@-1 {{if here [loplugin:simplifydynamiccast]}}
29 static_cast<ClassB*>(p1)
30 ->foo(); // expected-error@-1 {{simplify, use var in if [loplugin:simplifydynamiccast]}}
34 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */