Fix seg fault handling template parameter expressions containing '>='
Similar to previous commit Issue #1037
This commit is contained in:
parent
0341258af7
commit
ca5c68e544
3 changed files with 14 additions and 14 deletions
|
|
@ -8,7 +8,8 @@ Version 4.2.0 (in progress)
|
|||
===========================
|
||||
|
||||
2022-11-22: wsfulton
|
||||
#1037 Fix seg fault handling template parameter expressions containing '<='.
|
||||
#1037 Fix seg fault handling template parameter expressions containing '<='
|
||||
or '>='.
|
||||
|
||||
2022-11-18: wsfulton
|
||||
Duplicate class template instantiations via %template now issue a warning and are ignored.
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@ void tester() {
|
|||
template <typename T, std::enable_if_t<sizeof(T) <= 4>>
|
||||
void destId(T el) {}
|
||||
|
||||
/*
|
||||
not yet fixed
|
||||
template <typename T, std::enable_if_t<sizeof(T) >= 3>>
|
||||
void destId(const T& el) {}
|
||||
*/
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1043,16 +1043,17 @@ String *SwigType_templateprefix(const SwigType *t) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *SwigType_templatesuffix(const SwigType *t) {
|
||||
const char *c;
|
||||
const char *c, *d;
|
||||
c = Char(t);
|
||||
while (*c) {
|
||||
d = c + strlen(c);
|
||||
while (d > c) {
|
||||
if ((*c == '<') && (*(c + 1) == '(')) {
|
||||
int nest = 1;
|
||||
c++;
|
||||
while (*c && nest) {
|
||||
if (*c == '<')
|
||||
while ((d > c) && nest) {
|
||||
if (*c == '<' && *(c + 1) == '(')
|
||||
nest++;
|
||||
if (*c == '>')
|
||||
if (*c == '>' && *(c - 1) == ')')
|
||||
nest--;
|
||||
c++;
|
||||
}
|
||||
|
|
@ -1120,18 +1121,19 @@ String *SwigType_istemplate_only_templateprefix(const SwigType *t) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *SwigType_templateargs(const SwigType *t) {
|
||||
const char *c;
|
||||
const char *c, *d;
|
||||
const char *start;
|
||||
c = Char(t);
|
||||
while (*c) {
|
||||
d = c + strlen(c);
|
||||
while (d > c) {
|
||||
if ((*c == '<') && (*(c + 1) == '(')) {
|
||||
int nest = 1;
|
||||
start = c;
|
||||
c++;
|
||||
while (*c && nest) {
|
||||
if (*c == '<')
|
||||
while ((d > c) && nest) {
|
||||
if (*c == '<' && *(c + 1) == '(')
|
||||
nest++;
|
||||
if (*c == '>')
|
||||
if (*c == '>' && *(c - 1) == ')')
|
||||
nest--;
|
||||
c++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue