Fix support for member const function pointer variables
Was not generating code that compiled when the variable was not a simple member pointer, for example, a const reference member pointer: short (Funcs::* const& cc7)(bool) const = cc1;
This commit is contained in:
parent
685ee6cdc4
commit
eeab152901
4 changed files with 55 additions and 14 deletions
|
|
@ -1432,22 +1432,39 @@ static void mark_nodes_as_extend(Node *n) {
|
|||
static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) {
|
||||
int is_pointer_to_member_function = 0;
|
||||
String *decl = Copy(type);
|
||||
String *poppedtype = NewString("");
|
||||
assert(qualifier);
|
||||
if (SwigType_ismemberpointer(decl)) {
|
||||
String *memberptr = SwigType_pop(decl);
|
||||
if (SwigType_isfunction(decl)) {
|
||||
assert(!SwigType_isqualifier(decl));
|
||||
SwigType_push(decl, qualifier);
|
||||
SwigType_push(decl, memberptr);
|
||||
is_pointer_to_member_function = 1;
|
||||
|
||||
while (decl) {
|
||||
if (SwigType_ismemberpointer(decl)) {
|
||||
String *memberptr = SwigType_pop(decl);
|
||||
if (SwigType_isfunction(decl)) {
|
||||
is_pointer_to_member_function = 1;
|
||||
SwigType_push(decl, qualifier);
|
||||
SwigType_push(decl, memberptr);
|
||||
Insert(decl, 0, poppedtype);
|
||||
Delete(memberptr);
|
||||
break;
|
||||
} else {
|
||||
Append(poppedtype, memberptr);
|
||||
}
|
||||
Delete(memberptr);
|
||||
} else {
|
||||
Delete(decl);
|
||||
decl = Copy(type);
|
||||
String *popped = SwigType_pop(decl);
|
||||
if (!popped)
|
||||
break;
|
||||
Append(poppedtype, popped);
|
||||
Delete(popped);
|
||||
}
|
||||
Delete(memberptr);
|
||||
}
|
||||
if (!is_pointer_to_member_function)
|
||||
|
||||
if (!is_pointer_to_member_function) {
|
||||
Delete(decl);
|
||||
decl = Copy(type);
|
||||
SwigType_push(decl, qualifier);
|
||||
}
|
||||
|
||||
Delete(poppedtype);
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -670,6 +670,7 @@ SwigType *SwigType_ltype(const SwigType *s) {
|
|||
int nelements, i;
|
||||
int firstarray = 1;
|
||||
int notypeconv = 0;
|
||||
int memberpointer = 0;
|
||||
|
||||
result = NewStringEmpty();
|
||||
tc = Copy(s);
|
||||
|
|
@ -707,13 +708,16 @@ SwigType *SwigType_ltype(const SwigType *s) {
|
|||
notypeconv = 1;
|
||||
}
|
||||
if (SwigType_isqualifier(element)) {
|
||||
/* Do nothing. Ignore */
|
||||
if (memberpointer)
|
||||
Append(result, element);
|
||||
/* otherwise ignore */
|
||||
} else if (SwigType_ispointer(element)) {
|
||||
Append(result, element);
|
||||
firstarray = 0;
|
||||
} else if (SwigType_ismemberpointer(element)) {
|
||||
Append(result, element);
|
||||
firstarray = 0;
|
||||
memberpointer = 1;
|
||||
} else if (SwigType_isreference(element)) {
|
||||
if (notypeconv) {
|
||||
Append(result, element);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
* 'a(n).' = Array of size n [n]
|
||||
* 'f(..,..).' = Function with arguments (args)
|
||||
* 'q(str).' = Qualifier (such as const or volatile) (const, volatile)
|
||||
* 'm(qual).' = Pointer to member (qual::*)
|
||||
* 'm(cls).' = Pointer to member (cls::*)
|
||||
*
|
||||
* The complete type representation for varargs is:
|
||||
* 'v(...)'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue