[C++-sig] Problems with enum types in structs

Mark Russell mrussell8081 at pacbell.net
Wed Dec 18 21:27:41 CET 2002

The following code triggers an assert when I try to use a color type in
struct est.  This works in boost 1.29 enums has been recently changed to add
export_values is there something different I should be doing at this stage.
Thanks in advance.  --Mark

enum color { red, green, blue };

struct est {
	color rgb;

color identity_(color x) { return x; }

#include <boost/python.hpp>
using namespace boost::python;

	def("identity", identity_);
		.value("red", red)
		.value("green", green)
		.value("blue", blue)
		.def_readwrite("rgb", &est::rgb)

C:\BOOST\boost/python/object/make_instance.hpp(22) : error C2027: use of
undefined type 'STATIC_ASSERTION_FAILURE<0>'
        C:\BOOST\boost/python/to_python_indirect.hpp(60) : see reference to
function template instantiation 'struct _object *__cdecl
boost::python::objects::make_instance<enum color,struct
boost::python::objects::pointer_holder<enum color *,enum col
or> >::execute(enum color *& )' being compiled
Error executing cl.exe.

est.pyd - 1 error(s), 0 warning(s)

More information about the Cplusplus-sig mailing list