Index: base/memory/ref_counted_unittest.nc |
diff --git a/base/memory/ref_counted_unittest.nc b/base/memory/ref_counted_unittest.nc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5022779214a2ae082d9487360974b9ad4e3cba73 |
--- /dev/null |
+++ b/base/memory/ref_counted_unittest.nc |
@@ -0,0 +1,25 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/memory/ref_counted.h" |
+ |
+namespace base { |
+ |
+class InitialRefCountIsZero : public base::RefCounted<InitialRefCountIsZero> { |
+ public: |
+ InitialRefCountIsZero() {} |
+ private: |
+ friend class base::RefCounted<InitialRefCountIsZero>; |
+ ~InitialRefCountIsZero() {} |
+}; |
+ |
+#if defined(NCTEST_ADOPT_REF_TO_ZERO_START) // [r"fatal error: static_assert failed \"Use AdoptRef only for the reference count starts from one\.\""] |
+ |
+void WontCompile() { |
+ AdoptRef(new InitialRefCountIsZero()); |
+} |
+ |
+#endif |
+ |
+} // namespace base |