diff --git a/SWIG/Examples/test-suite/enums.i b/SWIG/Examples/test-suite/enums.i index 8136f7f8d..617732a5c 100644 --- a/SWIG/Examples/test-suite/enums.i +++ b/SWIG/Examples/test-suite/enums.i @@ -39,3 +39,13 @@ enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance; enum { AnonEnum1, AnonEnum2 = 100 }; %} + +%inline %{ + +typedef struct _Foo { + enum { BAR1, BAR2 } e; +} Foo; + +%} + + diff --git a/SWIG/Source/Modules/lang.cxx b/SWIG/Source/Modules/lang.cxx index fdcd72ae2..dfb081655 100644 --- a/SWIG/Source/Modules/lang.cxx +++ b/SWIG/Source/Modules/lang.cxx @@ -1527,7 +1527,7 @@ int Language::enumvalueDeclaration(Node *n) { tmpValue = NewString(name); Setattr(n, "value", tmpValue); - if (!CurrentClass) { + if (!CurrentClass || !cparse_cplusplus) { Setattr(n,"name",tmpValue); /* for wrapping of enums in a namespace when emit_action is used */ constantWrapper(n); } else { diff --git a/SWIG/Source/Modules/typepass.cxx b/SWIG/Source/Modules/typepass.cxx index 38d53b471..41b2e952d 100644 --- a/SWIG/Source/Modules/typepass.cxx +++ b/SWIG/Source/Modules/typepass.cxx @@ -20,6 +20,7 @@ char cvsroot_typepass_cxx[] = "$Header$"; #include "swigmod.h" +#include "cparse.h" struct normal_node { Symtab *symtab; @@ -726,7 +727,7 @@ class TypePass : private Dispatcher { if (!value) value = name; if (Strcmp(value,name) == 0) { String *new_value; - if ((nsname) || (inclass)) { + if (((nsname) || (inclass)) && cparse_cplusplus ) { new_value = NewStringf("%s::%s", SwigType_namestr(Swig_symbol_qualified(n)), value); } else { new_value = NewString(value);