Fix syntax error parsing variadic template parameter pack arguments
that are function pointers Issue #1863
This commit is contained in:
parent
b13f584258
commit
70837bbc26
3 changed files with 32 additions and 6 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.2.0 (in progress)
|
||||
===========================
|
||||
|
||||
2022-12-23: wsfulton
|
||||
#1863 Fix syntax error parsing variadic template parameter pack arguments that
|
||||
are function pointers.
|
||||
|
||||
2022-12-22: wsfulton
|
||||
Complete support for C++11 variadic templates. Support was previously limited
|
||||
to just one template parameter. Now zero or more template parameters are supported.
|
||||
|
|
|
|||
|
|
@ -143,15 +143,38 @@ public:
|
|||
%inline %{
|
||||
template <typename... V> struct VariadicParms {
|
||||
public:
|
||||
void ParmsVal(V... vparms_v) {}
|
||||
void ParmsPtr(V*... vparms_p) {}
|
||||
void ParmsPtrRef(V*&... vparms_pr) {}
|
||||
void ParmsPtrRValueRef(V*&&... vparms_rvr) {}
|
||||
void ParmsVal(V... vparms_v) {}
|
||||
void ParmsRef(V&... vparms_r) {}
|
||||
void ParmsRValueRef(V&&... vparms_r) {}
|
||||
void ParmsConstRef(const V&... vparms_cr) {}
|
||||
|
||||
// TODO
|
||||
// void ParmsFuncPtr(int (*)(V...)) {}
|
||||
};
|
||||
%}
|
||||
|
||||
%template(VariadicParms1) VariadicParms<A>;
|
||||
%template(VariadicParms2) VariadicParms<A,B>;
|
||||
%template(VariadicParms3) VariadicParms<A,B,C>;
|
||||
|
||||
|
||||
// #1863
|
||||
%inline %{
|
||||
class Container {
|
||||
public:
|
||||
template<typename... Args>
|
||||
static void notifyMyTypes(void (fn)(Args...));
|
||||
};
|
||||
%}
|
||||
%{
|
||||
template<typename... Args>
|
||||
void Container::notifyMyTypes(void (fn)(Args...)) {}
|
||||
|
||||
// Explicit template instantiations
|
||||
template void Container::notifyMyTypes<>(void (tt)());
|
||||
template void Container::notifyMyTypes<int>(void (tt)(int));
|
||||
template void Container::notifyMyTypes<int, double>(void (tt)(int, double));
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -5535,11 +5535,6 @@ declarator : pointer notso_direct_declarator {
|
|||
$$.type = $1;
|
||||
SwigType_add_variadic($$.type);
|
||||
}
|
||||
| ELLIPSIS direct_declarator {
|
||||
$$ = $2;
|
||||
if (!$$.type) $$.type = NewStringEmpty();
|
||||
SwigType_add_variadic($$.type);
|
||||
}
|
||||
| AND ELLIPSIS notso_direct_declarator {
|
||||
$$ = $3;
|
||||
$$.type = NewStringEmpty();
|
||||
|
|
@ -6170,6 +6165,10 @@ rawtype : type_qualifier type_right {
|
|||
SwigType_push($$,$3);
|
||||
SwigType_push($$,$1);
|
||||
}
|
||||
| rawtype ELLIPSIS {
|
||||
$$ = $1;
|
||||
SwigType_add_variadic($$);
|
||||
}
|
||||
;
|
||||
|
||||
type_right : primitive_type { $$ = $1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue