Fix seg fault handling template parameter expressions containing '<='

Recent commits ensure types are correctly stored in SwigType *. In
particular template parameters are enclosed within '<(' and ')>'.
Now we can confidently handle template parameters as really being
delimited as such to fix an infinite loop handling template expressions
containing '<' or '>'. The previous implementation only assumed
template parameters were delimited by '<' and '>'.

Issue #1037
This commit is contained in:
William S Fulton 2022-11-22 08:30:39 +00:00
commit 0341258af7
3 changed files with 24 additions and 5 deletions

View file

@ -37,3 +37,16 @@ void tester() {
// non-type template parameters working well in SWIG, below is a simple workaround as the 3rd parameter is defaulted for enable_if_t (which is just SFINAE to give a nice C++ compiler error)
%template(enableif5) enableif5<int, int, true>; // workaround
%inline %{
// #1037 infinite loop
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) {}
*/
%}