fix error #1468674 enums + char
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9057 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
378283b5c2
commit
864e179723
2 changed files with 28 additions and 2 deletions
|
|
@ -49,3 +49,27 @@ typedef struct _Foo {
|
|||
%}
|
||||
|
||||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) iFoo; /* Ruby, wrong constant name */
|
||||
|
||||
#ifndef __cplusplus
|
||||
%inline %{
|
||||
typedef struct _iFoo
|
||||
{
|
||||
enum {
|
||||
Phoo = +50,
|
||||
Char = 'a'
|
||||
} e;
|
||||
} iFoo;
|
||||
%}
|
||||
#else
|
||||
%inline %{
|
||||
struct iFoo
|
||||
{
|
||||
enum {
|
||||
Phoo = +50,
|
||||
Char = 'a'
|
||||
};
|
||||
};
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5236,7 +5236,7 @@ edecl : ID {
|
|||
Setattr($$,"enumvalue", $3.val);
|
||||
if ($3.type == T_CHAR) {
|
||||
SwigType *type = NewSwigType(T_CHAR);
|
||||
Setattr($$,k_value,$3.val);
|
||||
Setattr($$,k_value,NewStringf("\'%(escape)s\'", $3.val));
|
||||
Setattr($$,k_type,type);
|
||||
Delete(type);
|
||||
} else {
|
||||
|
|
@ -5255,9 +5255,11 @@ etype : expr {
|
|||
if (($$.type != T_INT) && ($$.type != T_UINT) &&
|
||||
($$.type != T_LONG) && ($$.type != T_ULONG) &&
|
||||
($$.type != T_SHORT) && ($$.type != T_USHORT) &&
|
||||
($$.type != T_SCHAR) && ($$.type != T_UCHAR)) {
|
||||
($$.type != T_SCHAR) && ($$.type != T_UCHAR) &&
|
||||
($$.type != T_CHAR)) {
|
||||
Swig_error(cparse_file,cparse_line,"Type error. Expecting an int\n");
|
||||
}
|
||||
if ($$.type == T_CHAR) $$.type = T_INT;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue