Fix static const char member variables wrappers with %javaconst(1).

This fixes the case when an integer is used as the initializer, such as:

  struct W { static const char w = 100; };

The "valuetype" attribute has been added to the "cdecl" Node which enables
us to distinguish the declared type from the type of the initializer.
This commit is contained in:
William S Fulton 2016-01-27 08:54:44 +00:00
commit 7339de974d
4 changed files with 55 additions and 2 deletions

View file

@ -2926,6 +2926,14 @@ c_decl : storage_class type declarator initializer c_decl_tail {
Setattr($$,"throws",$4.throws);
Setattr($$,"throw",$4.throwf);
Setattr($$,"noexcept",$4.nexcept);
if ($4.val && $4.type) {
/* store initializer type as it might be different to the declared type */
SwigType *valuetype = NewSwigType($4.type);
if (Len(valuetype) > 0)
Setattr($$,"valuetype",valuetype);
else
Delete(valuetype);
}
if (!$5) {
if (Len(scanner_ccode)) {
String *code = Copy(scanner_ccode);