diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-12-29 21:04:48 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-12-30 00:19:02 +0000 |
commit | 004af63f3cef63fbe91389cec1ad0c84498915e2 (patch) | |
tree | c8692bb445e824465f5481c6e4e651a7f07b253f /Source | |
parent | 674abaddbf854e2374f115ef08e59fa79702e19a (diff) | |
download | swig-004af63f3cef63fbe91389cec1ad0c84498915e2.tar.gz |
Syntax error fixes parsing more elaborate parameter pack arguments
that are function pointers and member function pointers.
template <typename... V> struct VariadicParms {
void ParmsFuncPtrPtr(int (*)(V*...)) {}
void ParmsFuncPtrPtrRef(int (*)(V*&...)) {}
void ParmsFuncPtrPtrRValueRef(int (*)(V*&&...)) {}
void ParmsFuncPtrRef(int (*)(V&...)) {}
void ParmsFuncPtrRValueRef(int (*)(V&&...)) {}
void ParmsMemFuncPtrPtr(int (KlassMemFuncs::*)(V*...)) {}
void ParmsMemFuncPtrPtrRef(int (KlassMemFuncs::*)(V*&...)) {}
void ParmsMemFuncPtrPtrRValueRef(int (KlassMemFuncs::*)(V*&&...)) {}
void ParmsMemFuncPtrRef(int (KlassMemFuncs::*)(V&...)) {}
void ParmsMemFuncPtrRValueRef(int (KlassMemFuncs::*)(V&&...)) {}
};
%template(VariadicParms0) VariadicParms<>;
%template(VariadicParms1) VariadicParms<A>;
Also in various other places such as within noexcept specifiers:
template<typename T, typename... Args>
void emplace(Args &&... args) noexcept(
std::is_nothrow_constructible<T, Args &&...>::value);
Issue #1863
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CParse/parser.y | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index d5fcd2fda..4035119a1 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1684,7 +1684,7 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier) %type <type> templcpptype cpptype classkey classkeyopt; %type <id> access_specifier; %type <node> base_specifier; -%type <str> variadic; +%type <str> variadic_opt; %type <type> type rawtype type_right anon_bitfield_type decltype ; %type <bases> base_list inherit raw_inherit; %type <dtype> definetype def_args etype default_delete deleted_definition explicit_default; @@ -5877,11 +5877,12 @@ direct_declarator : idcolon { } ; -abstract_declarator : pointer { +abstract_declarator : pointer variadic_opt { $$.type = $1; $$.id = 0; $$.parms = 0; $$.have_parms = 0; + if ($2) SwigType_add_variadic($$.type); } | pointer direct_abstract_declarator { $$ = $2; @@ -5889,19 +5890,21 @@ abstract_declarator : pointer { $$.type = $1; Delete($2.type); } - | pointer AND { + | pointer AND variadic_opt { $$.type = $1; SwigType_add_reference($$.type); $$.id = 0; $$.parms = 0; $$.have_parms = 0; + if ($3) SwigType_add_variadic($$.type); } - | pointer LAND { + | pointer LAND variadic_opt { $$.type = $1; SwigType_add_rvalue_reference($$.type); $$.id = 0; $$.parms = 0; $$.have_parms = 0; + if ($3) SwigType_add_variadic($$.type); } | pointer AND direct_abstract_declarator { $$ = $3; @@ -5942,19 +5945,21 @@ abstract_declarator : pointer { Delete($2.type); } } - | AND { + | AND variadic_opt { $$.id = 0; $$.parms = 0; $$.have_parms = 0; $$.type = NewStringEmpty(); SwigType_add_reference($$.type); + if ($2) SwigType_add_variadic($$.type); } - | LAND { + | LAND variadic_opt { $$.id = 0; $$.parms = 0; $$.have_parms = 0; $$.type = NewStringEmpty(); SwigType_add_rvalue_reference($$.type); + if ($2) SwigType_add_variadic($$.type); } | idcolon DSTAR { $$.type = NewStringEmpty(); @@ -6155,7 +6160,9 @@ rawtype : type_qualifier type_right { $$ = $2; SwigType_push($$,$1); } - | type_right { $$ = $1; } + | type_right { + $$ = $1; + } | type_right type_qualifier { $$ = $1; SwigType_push($$,$2); @@ -6876,7 +6883,7 @@ exprcompound : expr PLUS expr { } ; -variadic : ELLIPSIS { +variadic_opt : ELLIPSIS { $$ = NewString("..."); } | empty { @@ -6921,7 +6928,7 @@ base_list : base_specifier { base_specifier : opt_virtual { $<intvalue>$ = cparse_line; - } idcolon variadic { + } idcolon variadic_opt { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,$<intvalue>2); @@ -6940,7 +6947,7 @@ base_specifier : opt_virtual { } | opt_virtual access_specifier { $<intvalue>$ = cparse_line; - } opt_virtual idcolon variadic { + } opt_virtual idcolon variadic_opt { $$ = NewHash(); Setfile($$,cparse_file); Setline($$,$<intvalue>3); |