Fix infinite loop handling non-type template parameters
Fixes infinite loop due to () brackets in a non-type template parameter containing an expression Fixes #2418 Non-trivial expressions are still not qualified properly though.
This commit is contained in:
parent
973590ff91
commit
52edda64c1
6 changed files with 69 additions and 3 deletions
|
|
@ -1518,7 +1518,8 @@ Node *Swig_symbol_isoverloaded(Node *n) {
|
|||
static SwigType *symbol_template_qualify(const SwigType *e, Symtab *st) {
|
||||
String *tprefix, *tsuffix;
|
||||
SwigType *qprefix;
|
||||
List *targs;
|
||||
String *targs;
|
||||
List *targslist;
|
||||
Node *tempn;
|
||||
Symtab *tscope;
|
||||
Iterator ti;
|
||||
|
|
@ -1541,12 +1542,15 @@ static SwigType *symbol_template_qualify(const SwigType *e, Symtab *st) {
|
|||
tprefix = SwigType_templateprefix(e);
|
||||
tsuffix = SwigType_templatesuffix(e);
|
||||
qprefix = Swig_symbol_type_qualify(tprefix, st);
|
||||
targs = SwigType_parmlist(e);
|
||||
targs = SwigType_templateargs(e);
|
||||
targslist = SwigType_parmlist(targs);
|
||||
tempn = Swig_symbol_clookup_local(tprefix, st);
|
||||
tscope = tempn ? Getattr(tempn, "sym:symtab") : 0;
|
||||
Append(qprefix, "<(");
|
||||
for (ti = First(targs); ti.item;) {
|
||||
for (ti = First(targslist); ti.item;) {
|
||||
String *vparm;
|
||||
/* TODO: the logic here should be synchronised with that in SwigType_typedef_qualified() */
|
||||
/* TODO: ti.item might be a non-type parameter possibly within (), eg: (std::is_integral_v<(A)>||std::is_same_v<(A,node_t)>) */
|
||||
String *qparm = Swig_symbol_type_qualify(ti.item, st);
|
||||
if (tscope && (tscope != st)) {
|
||||
String *ty = Swig_symbol_type_qualify(qparm, tscope);
|
||||
|
|
@ -1568,6 +1572,7 @@ static SwigType *symbol_template_qualify(const SwigType *e, Symtab *st) {
|
|||
Delete(tprefix);
|
||||
Delete(tsuffix);
|
||||
Delete(targs);
|
||||
Delete(targslist);
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stderr, "symbol_temp_qual %s %s\n", e, qprefix);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1148,6 +1148,7 @@ SwigType *SwigType_typedef_qualified(const SwigType *t) {
|
|||
Append(qprefix, "<(");
|
||||
pi = First(parms);
|
||||
while ((p = pi.item)) {
|
||||
/* TODO: the logic here should be synchronised with that in symbol_template_qualify() in symbol.c */
|
||||
String *qt = SwigType_typedef_qualified(p);
|
||||
if (Equal(qt, p)) { /* && (!Swig_scopename_check(qt))) */
|
||||
/* No change in value. It is entirely possible that the parameter is an integer value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue