2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-20 04:42:28 +00:00
Files
python/test/upcast.cpp
Daniel James 5d3b58f6f7 Create a branch for documentation work.
[SVN r44584]
2008-04-19 14:48:18 +00:00

20 lines
561 B
C++

// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python/cast.hpp>
#include <boost/detail/lightweight_test.hpp>
struct X { long x; };
struct Y : X, PyObject {};
int main()
{
PyTypeObject o;
Y y;
BOOST_TEST(&boost::python::upcast<PyObject>(&o)->ob_refcnt == &o.ob_refcnt);
BOOST_TEST(&boost::python::upcast<PyObject>(&y)->ob_refcnt == &y.ob_refcnt);
return boost::report_errors();
}