smart pointer refcount fix by @dean0x7d with slight modifications (fixes #471)
diff --git a/tests/test_issues.py b/tests/test_issues.py
index cf645ef..208cf3b 100644
--- a/tests/test_issues.py
+++ b/tests/test_issues.py
@@ -1,5 +1,6 @@
 import pytest
 import gc
+from pybind11_tests import ConstructorStats
 
 
 def test_regressions():
@@ -187,3 +188,16 @@
     """ Issue 461: overwriting a class with a function """
     from pybind11_tests.issues import dupe_exception_failures
     assert dupe_exception_failures() == []
+
+
+def test_enable_shared_from_this_with_reference_rvp():
+    """ Issue #471: shared pointer instance not dellocated """
+    from pybind11_tests import SharedParent, SharedChild
+
+    parent = SharedParent()
+    child = parent.get_child()
+
+    cstats = ConstructorStats.get(SharedChild)
+    assert cstats.alive() == 1
+    del child, parent
+    assert cstats.alive() == 0