Update .DEPS.git
[chromium-blink-merge.git] / base / memory / scoped_ptr_unittest.nc
blob30a332edcd469e565089f06922300fc5a3e64423
1 // Copyright (c) 2012 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.
5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/ref_counted.h"
9 namespace {
11 class Parent {
14 class Child : public Parent {
17 class RefCountedClass : public base::RefCountedThreadSafe<RefCountedClass> {
20 }  // namespace
22 #if defined(NCTEST_NO_PASSAS_DOWNCAST)  // [r"invalid conversion from"]
24 scoped_ptr<Child> DowncastUsingPassAs(scoped_ptr<Parent> object) {
25   return object.PassAs<Child>();
28 #elif defined(NCTEST_NO_REF_COUNTED_SCOPED_PTR)  // [r"creating array with negative size"]
30 // scoped_ptr<> should not work for ref-counted objects.
31 void WontCompile() {
32   scoped_ptr<RefCountedClass> x;
35 #endif