OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/memory/ref_counted.h" |
| 6 |
| 7 namespace base { |
| 8 |
| 9 class InitialRefCountIsZero : public base::RefCounted<InitialRefCountIsZero> { |
| 10 public: |
| 11 InitialRefCountIsZero() {} |
| 12 private: |
| 13 friend class base::RefCounted<InitialRefCountIsZero>; |
| 14 ~InitialRefCountIsZero() {} |
| 15 }; |
| 16 |
| 17 #if defined(NCTEST_ADOPT_REF_TO_ZERO_START) // [r"fatal error: static_assert fa
iled \"Use AdoptRef only for the reference count starts from one\.\""] |
| 18 |
| 19 void WontCompile() { |
| 20 AdoptRef(new InitialRefCountIsZero()); |
| 21 } |
| 22 |
| 23 #endif |
| 24 |
| 25 } // namespace base |
OLD | NEW |