Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Unified Diff: tests/RefCntTest.cpp

Issue 1771583002: sk_sp: fix contravariant constructors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RefCntTest.cpp
diff --git a/tests/RefCntTest.cpp b/tests/RefCntTest.cpp
index 60a34ecf886826ecaa972ac612c18ee1d1d8a702..8914ccff49a092fc2ca8d337cf80a1f9090fb15a 100644
--- a/tests/RefCntTest.cpp
+++ b/tests/RefCntTest.cpp
@@ -274,3 +274,19 @@ DEF_TEST(sk_sp, reporter) {
check(reporter, 1, 2, 1, 1);
}
+namespace {
+struct FooAbstract : public SkRefCnt {
+ virtual void f() = 0;
+};
+struct FooConcrete : public FooAbstract {
+ void f() override {}
+};
+}
+static sk_sp<FooAbstract> make_foo() {
+ // can not cast FooConcrete to FooAbstract.
+ // can cast FooConcrete* to FooAbstract*.
+ return sk_make_sp<FooConcrete>();
+}
+DEF_TEST(sk_make_sp, r) {
+ auto x = make_foo();
+}
« no previous file with comments | « include/core/SkRefCnt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698