Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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/scoped_ptr.h" | |
| 6 | |
| 7 void TestDeclarations() { | |
| 8 scoped_ptr<int> a(NULL), b(new int), c(NULL); | |
| 9 scoped_ptr_malloc<int> d(NULL); | |
| 10 } | |
| 11 | |
| 12 void TestNew() { | |
| 13 scoped_ptr<int>* a = new scoped_ptr<int>(NULL), | |
|
Nico
2013/06/11 19:58:13
Do you want to check `scoped_ptr<int>( (NULL) )` s
dcheng
2013/06/11 20:07:41
I think that's covered by lines 30-33?
| |
| 14 *b = new scoped_ptr<int>(new int), | |
| 15 *c = new scoped_ptr<int>(NULL); | |
| 16 } | |
| 17 | |
| 18 class TestInitializers { | |
| 19 public: | |
| 20 TestInitializers() : a(NULL) {} | |
| 21 TestInitializers(bool) : a(NULL), b(NULL) {} | |
| 22 TestInitializers(double) : a(NULL), b(new int), c() {} | |
| 23 | |
| 24 private: | |
| 25 scoped_ptr<int> a; | |
| 26 scoped_ptr<int> b; | |
| 27 scoped_ptr<int> c; | |
| 28 }; | |
| 29 | |
| 30 scoped_ptr<int> TestTemporaries(scoped_ptr<int> a, scoped_ptr<int> b) { | |
| 31 scoped_ptr<int> c = | |
| 32 TestTemporaries(scoped_ptr<int>(NULL), scoped_ptr<int>(new int)); | |
| 33 return scoped_ptr<int>(NULL); | |
| 34 } | |
| 35 | |
| OLD | NEW |