D: Emit empty enums as int aliases instead of omitting them.
This fixes test-suite/enum_forward.i.
This commit is contained in:
parent
a9d7b7f40c
commit
a8cdd1798e
1 changed files with 15 additions and 15 deletions
|
|
@ -803,12 +803,7 @@ public:
|
||||||
// Emit each enum item.
|
// Emit each enum item.
|
||||||
Language::enumDeclaration(n);
|
Language::enumDeclaration(n);
|
||||||
|
|
||||||
if (!GetFlag(n, "nonempty")) {
|
if (GetFlag(n, "nonempty")) {
|
||||||
// Do not wrap empty enums; the resulting D code would be illegal.
|
|
||||||
Delete(proxy_enum_code);
|
|
||||||
return SWIG_NOWRAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish the enum.
|
// Finish the enum.
|
||||||
if (typemap_lookup_type) {
|
if (typemap_lookup_type) {
|
||||||
Printv(proxy_enum_code,
|
Printv(proxy_enum_code,
|
||||||
|
|
@ -818,8 +813,13 @@ public:
|
||||||
// Handle anonymous enums.
|
// Handle anonymous enums.
|
||||||
Printv(proxy_enum_code, "\n}\n", NIL);
|
Printv(proxy_enum_code, "\n}\n", NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Replaceall(proxy_enum_code, "$dclassname", symname);
|
Replaceall(proxy_enum_code, "$dclassname", symname);
|
||||||
|
} else {
|
||||||
|
// D enum declarations must have at least one member to be legal, so emit
|
||||||
|
// an alias to int instead (their ctype/imtype is always int).
|
||||||
|
Delete(proxy_enum_code);
|
||||||
|
proxy_enum_code = NewStringf("\nalias int %s;\n", symname);
|
||||||
|
}
|
||||||
|
|
||||||
const String* imports =
|
const String* imports =
|
||||||
lookupCodeTypemap(n, "dimports", typemap_lookup_type, WARN_NONE);
|
lookupCodeTypemap(n, "dimports", typemap_lookup_type, WARN_NONE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue