summaryrefslogtreecommitdiffstats
path: root/base/memory/scoped_ptr_unittest.nc
diff options
context:
space:
mode:
Diffstat (limited to 'base/memory/scoped_ptr_unittest.nc')
-rw-r--r--base/memory/scoped_ptr_unittest.nc11
1 files changed, 11 insertions, 0 deletions
diff --git a/base/memory/scoped_ptr_unittest.nc b/base/memory/scoped_ptr_unittest.nc
index 841d03c..30a332e 100644
--- a/base/memory/scoped_ptr_unittest.nc
+++ b/base/memory/scoped_ptr_unittest.nc
@@ -4,6 +4,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/ref_counted.h"
namespace {
@@ -13,6 +14,9 @@ class Parent {
class Child : public Parent {
};
+class RefCountedClass : public base::RefCountedThreadSafe<RefCountedClass> {
+};
+
} // namespace
#if defined(NCTEST_NO_PASSAS_DOWNCAST) // [r"invalid conversion from"]
@@ -21,4 +25,11 @@ scoped_ptr<Child> DowncastUsingPassAs(scoped_ptr<Parent> object) {
return object.PassAs<Child>();
}
+#elif defined(NCTEST_NO_REF_COUNTED_SCOPED_PTR) // [r"creating array with negative size"]
+
+// scoped_ptr<> should not work for ref-counted objects.
+void WontCompile() {
+ scoped_ptr<RefCountedClass> x;
+}
+
#endif