1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
12 void f(struct Incomplete
* p1
, struct S
* p2
);
19 void f(struct Incomplete
* p1
, struct S
* p2
)
22 // expected-error@+1 {{writing to an object of non-trivial type 'S'; use assignment instead [loplugin:classmemaccess]}}
23 std::memset(&s
, 0, sizeof s
);
24 // expected-error@+1 {{writing to an object of non-trivial type 'S'; use assignment instead [loplugin:classmemaccess]}}
25 std::memset(static_cast<void*>(&s
), 0, sizeof s
);
26 auto const disableWarning
= static_cast<void*>(&s
);
27 std::memset(disableWarning
, 0, sizeof s
);
29 // expected-error@+1 {{writing to an object of non-trivial type 'S'; use assignment instead [loplugin:classmemaccess]}}
30 std::memset(a
, 0, sizeof a
);
31 std::memset(p1
, 0, 10); // conservatively assume Incomplete may be trivial
32 // expected-error@+1 {{writing to an object of non-trivial type 'S'; use assignment instead [loplugin:classmemaccess]}}
33 std::memset(p2
, 0, 10);
36 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */