summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-11-22 08:30:39 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-11-22 08:37:35 +0000
commit0341258af7003121cdddda78c868ea2d497f8364 (patch)
tree0b9415364f9939a3445494b1733a187879e3d1e9 /Examples
parent29bc7492a2ec300997eaf670bf24f1556fef08cd (diff)
downloadswig-0341258af7003121cdddda78c868ea2d497f8364.tar.gz
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
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/cpp17_enable_if_t.i13
1 files changed, 13 insertions, 0 deletions
diff --git a/Examples/test-suite/cpp17_enable_if_t.i b/Examples/test-suite/cpp17_enable_if_t.i
index b361775d0..7c188dcfa 100644
--- a/Examples/test-suite/cpp17_enable_if_t.i
+++ b/Examples/test-suite/cpp17_enable_if_t.i
@@ -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) {}
+*/
+%}