Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #include "base_refcounted.h" |
michael@0 | 6 | |
michael@0 | 7 | #include <cstddef> |
michael@0 | 8 | |
michael@0 | 9 | namespace { |
michael@0 | 10 | |
michael@0 | 11 | // Unsafe; should error. |
michael@0 | 12 | class AnonymousDerivedProtectedToPublicInImpl |
michael@0 | 13 | : public ProtectedRefCountedDtorInHeader { |
michael@0 | 14 | public: |
michael@0 | 15 | AnonymousDerivedProtectedToPublicInImpl() {} |
michael@0 | 16 | ~AnonymousDerivedProtectedToPublicInImpl() {} |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | } // namespace |
michael@0 | 20 | |
michael@0 | 21 | // Unsafe; should error. |
michael@0 | 22 | class PublicRefCountedDtorInImpl |
michael@0 | 23 | : public base::RefCounted<PublicRefCountedDtorInImpl> { |
michael@0 | 24 | public: |
michael@0 | 25 | PublicRefCountedDtorInImpl() {} |
michael@0 | 26 | ~PublicRefCountedDtorInImpl() {} |
michael@0 | 27 | |
michael@0 | 28 | private: |
michael@0 | 29 | friend class base::RefCounted<PublicRefCountedDtorInImpl>; |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | class Foo { |
michael@0 | 33 | public: |
michael@0 | 34 | class BarInterface { |
michael@0 | 35 | protected: |
michael@0 | 36 | virtual ~BarInterface() {} |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | typedef base::RefCounted<BarInterface> RefCountedBar; |
michael@0 | 40 | typedef RefCountedBar AnotherTypedef; |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | class Baz { |
michael@0 | 44 | public: |
michael@0 | 45 | typedef typename Foo::AnotherTypedef MyLocalTypedef; |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | // Unsafe; should error. |
michael@0 | 49 | class UnsafeTypedefChainInImpl : public Baz::MyLocalTypedef { |
michael@0 | 50 | public: |
michael@0 | 51 | UnsafeTypedefChainInImpl() {} |
michael@0 | 52 | ~UnsafeTypedefChainInImpl() {} |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | int main() { |
michael@0 | 56 | PublicRefCountedDtorInHeader bad; |
michael@0 | 57 | PublicRefCountedDtorInImpl also_bad; |
michael@0 | 58 | |
michael@0 | 59 | ProtectedRefCountedDtorInHeader* protected_ok = NULL; |
michael@0 | 60 | PrivateRefCountedDtorInHeader* private_ok = NULL; |
michael@0 | 61 | |
michael@0 | 62 | DerivedProtectedToPublicInHeader still_bad; |
michael@0 | 63 | PublicRefCountedThreadSafeDtorInHeader another_bad_variation; |
michael@0 | 64 | AnonymousDerivedProtectedToPublicInImpl and_this_is_bad_too; |
michael@0 | 65 | ImplicitDerivedProtectedToPublicInHeader bad_yet_again; |
michael@0 | 66 | UnsafeTypedefChainInImpl and_again_this_is_bad; |
michael@0 | 67 | |
michael@0 | 68 | WebKitPublicDtorInHeader ignored; |
michael@0 | 69 | WebKitDerivedPublicDtorInHeader still_ignored; |
michael@0 | 70 | |
michael@0 | 71 | return 0; |
michael@0 | 72 | } |