Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/memory/ref_counted.h" | |
| 7 | 8 |
| 8 namespace { | 9 namespace { |
| 9 | 10 |
| 10 class Parent { | 11 class Parent { |
| 11 }; | 12 }; |
| 12 | 13 |
| 13 class Child : public Parent { | 14 class Child : public Parent { |
| 14 }; | 15 }; |
| 15 | 16 |
| 17 class RefCountedClass : public base::RefCountedThreadSafe<RefCountedClass> { | |
| 18 }; | |
| 19 | |
| 16 } // namespace | 20 } // namespace |
| 17 | 21 |
| 18 #if defined(NCTEST_NO_PASSAS_DOWNCAST) // [r"invalid conversion from"] | 22 #if defined(NCTEST_NO_PASSAS_DOWNCAST) // [r"invalid conversion from"] |
| 19 | 23 |
| 20 scoped_ptr<Child> DowncastUsingPassAs(scoped_ptr<Parent> object) { | 24 scoped_ptr<Child> DowncastUsingPassAs(scoped_ptr<Parent> object) { |
| 21 return object.PassAs<Child>(); | 25 return object.PassAs<Child>(); |
| 22 } | 26 } |
| 23 | 27 |
| 28 #elif defined(NCTEST_NO_REF_COUNTED_SCOPED_PTR) // [r"creating array with negat ive size"] | |
|
brettw
2012/04/04 21:31:06
Is it possible to wrap this somehow to 80 cols? I
Sergey Ulanov
2012/04/04 22:28:38
Don't think it is possible right now - all other n
| |
| 29 | |
| 30 // scoped_ptr<> should not work for ref-counted objects. | |
| 31 void WontCompile() { | |
| 32 scoped_ptr<RefCountedClass> x; | |
| 33 } | |
| 34 | |
| 24 #endif | 35 #endif |
| OLD | NEW |