Commit fcfd16c7 authored by Ashwin Srinath's avatar Ashwin Srinath Committed by GitHub

Fix Python 3.4 + MSVC issue with elaborated type specifier for enum (GH-3782)

parent fb02b15d
......@@ -4049,7 +4049,7 @@ class CppScopedEnumType(CType):
self.cname
)
else:
type_name = "enum %s" % self.cname
type_name = "__PYX_ENUM_CLASS_DECL %s" % self.cname
type_name = public_decl(type_name, dll_linkage)
return self.base_declaration_code(type_name, entity_code)
......
......@@ -701,6 +701,9 @@ class Scope(object):
type = PyrexTypes.c_anon_enum_type
entry = self.declare_type(name, type, pos, cname = cname,
visibility = visibility, api = api)
if scoped:
entry.utility_code = Code.UtilityCode.load_cached("EnumClassDecl", "CppSupport.cpp")
self.use_entry_utility_code(entry)
entry.create_wrapper = create_wrapper
entry.enum_values = []
......
......@@ -67,3 +67,15 @@ auto __Pyx_pythran_to_python(T &&value) -> decltype(to_python(
#else
#define __PYX_STD_MOVE_IF_SUPPORTED(x) x
#endif
////////////// EnumClassDecl.proto //////////////////
#if defined (_MSC_VER)
#if PY_VERSION_HEX >= 0x03040000 && PY_VERSION_HEX < 0x03050000
#define __PYX_ENUM_CLASS_DECL
#else
#define __PYX_ENUM_CLASS_DECL enum
#endif
#else
#define __PYX_ENUM_CLASS_DECL enum
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment