enable_shared_from_this-related fixes.

[SVN r16341]
This commit is contained in:
Peter Dimov
2002-11-20 12:38:51 +00:00
parent 4b200e9847
commit 804b1483c7
4 changed files with 42 additions and 35 deletions

View File

@@ -72,7 +72,10 @@ int main()
return boost::report_errors();
}
class impl: public X, public Y, public boost::enable_shared_from_this<impl>
// virtual inheritance from Y to stress the implementation
// (prevents Y* -> impl* casts)
class impl: public X, public virtual Y, public boost::enable_shared_from_this<impl>
{
public:
@@ -88,8 +91,14 @@ public:
}
};
// intermediate impl2 to stress the implementation
class impl2: public impl
{
};
boost::shared_ptr<Y> createY()
{
boost::shared_ptr<impl> pi(new impl);
boost::shared_ptr<Y> pi(new impl2);
return pi;
}