Fix uncompileable code when %rename results in two enum items with the same name

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12098 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-06-03 17:44:42 +00:00
commit 257ce20f30
4 changed files with 17 additions and 1 deletions

View file

@ -5,3 +5,6 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.1 (in progress)
===========================
2010-06-03: wsfulton
Fix uncompileable code when %rename results in two enum items
with the same name. Reported by Vadim Zeitlin.

View file

@ -180,6 +180,7 @@ CPP_TEST_CASES += \
disown \
dynamic_cast \
empty \
enum_rename \
enum_scope_template \
enum_template \
enum_thorough \

View file

@ -0,0 +1,12 @@
%module enum_rename
%warnfilter(SWIGWARN_PARSE_REDEFINED) S_May;
// %rename with rxspencer can do the equivalent of these two renames, which was resulting in uncompileable code
%rename(May) M_May;
%rename(May) S_May;
%inline %{
enum Month { M_Jan, M_May, M_Dec };
enum Severity { S_May, S_Can, S_Must };
%}

View file

@ -796,7 +796,7 @@ class TypePass:private Dispatcher {
bool reset;
String *enumvalue = Getattr(c, "enumvalue");
if (GetFlag(c, "feature:ignore")) {
if (GetFlag(c, "feature:ignore") || !Getattr(c, "sym:name")) {
reset = enumvalue ? true : false;
previous_ignored = true;
} else {