From 44990e2562c02e47ab443ff7d9876a18828d4388 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Sat, 27 Jul 2024 17:53:45 +1200 Subject: [PATCH] Move #2087 regression test to cpp11_noexcept.i --- Examples/test-suite/cpp11_noexcept.i | 9 +++++++++ Examples/test-suite/funcptr_cpp.i | 16 ---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Examples/test-suite/cpp11_noexcept.i b/Examples/test-suite/cpp11_noexcept.i index 6b0584473..1af065070 100644 --- a/Examples/test-suite/cpp11_noexcept.i +++ b/Examples/test-suite/cpp11_noexcept.i @@ -62,3 +62,12 @@ struct NoExceptDefaultDelete { %} +// Regression tests for #2087 (noexcept on a function pointer parameter type). +// +// FIXME: We've only fixed `noexcept` on parameter types which are function +// pointers to parse - the generated code has `noexcept` in the wrong place +// and won't compile so for now we only check SWIG can parse this. +%ignore f2087a; +%ignore f2087b; +void f2087a(int (*g)() noexcept) { (void)g; } +void f2087b(int const (*g)() noexcept) { (void)g; } diff --git a/Examples/test-suite/funcptr_cpp.i b/Examples/test-suite/funcptr_cpp.i index 43b68c23f..c25819d50 100644 --- a/Examples/test-suite/funcptr_cpp.i +++ b/Examples/test-suite/funcptr_cpp.i @@ -25,12 +25,6 @@ int callconst1(int (* const d)(const int &, int), int a, int b) { return d(a, b) %constant int & (*ADD_BY_REFERENCE)(const int &, int) = addByReference; %constant int (* const ADD_BY_VALUE_C)(const int &, int) = addByValue; -// FIXME: We've only fixed `noexcept` on parameter types which are function -// pointers to parse - the generated code has `noexcept` in the wrong place -// and won't compile so for now don't try to actually wrap the function. -%ignore f2087a; -%ignore f2087b; - %inline %{ typedef int AddByValueTypedef(const int &a, int b); typedef int * AddByPointerTypedef(const int &a, int b); @@ -38,14 +32,4 @@ typedef int & AddByReferenceTypedef(const int &a, int b); void *typedef_call1(AddByValueTypedef *& precallback, AddByValueTypedef * postcallback) { return 0; } void *typedef_call2(AddByPointerTypedef *& precallback, AddByPointerTypedef * postcallback) { return 0; } void *typedef_call3(AddByReferenceTypedef *& precallback, AddByReferenceTypedef * postcallback) { return 0; } - -#if __cplusplus >= 201103L || defined(SWIG) -# define NOEXCEPT noexcept -#else -# define NOEXCEPT -#endif - -// Regression tests for #2087 (noexcept on a function pointer parameter type): -void f2087a(int (*g)() NOEXCEPT) { (void)g; } -void f2087b(int const (*g)() NOEXCEPT) { (void)g; } %}