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 7namespace base { 8 9class InitialRefCountIsZero : public base::RefCounted<InitialRefCountIsZero> { 10 public: 11 InitialRefCountIsZero() {} 12 private: 13 friend class base::RefCounted<InitialRefCountIsZero>; 14 ~InitialRefCountIsZero() {} 15}; 16 17// TODO(hans): Remove .* and update the static_assert expectations once we roll 18// past Clang r313315. https://crbug.com/765692. 19 20#if defined(NCTEST_ADOPT_REF_TO_ZERO_START) // [r"fatal error: static_assert failed .*\"Use AdoptRef only for the reference count starts from one\.\""] 21 22void WontCompile() { 23 AdoptRef(new InitialRefCountIsZero()); 24} 25 26#endif 27 28} // namespace base 29