Move #2087 regression test to cpp11_noexcept.i

This commit is contained in:
Olly Betts 2024-07-27 17:53:45 +12:00
parent a0a50812b5
commit 44990e2562
2 changed files with 9 additions and 16 deletions

View File

@ -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; }

View File

@ -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 & (*ADD_BY_REFERENCE)(const int &, int) = addByReference;
%constant int (* const ADD_BY_VALUE_C)(const int &, int) = addByValue; %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 %{ %inline %{
typedef int AddByValueTypedef(const int &a, int b); typedef int AddByValueTypedef(const int &a, int b);
typedef int * AddByPointerTypedef(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_call1(AddByValueTypedef *& precallback, AddByValueTypedef * postcallback) { return 0; }
void *typedef_call2(AddByPointerTypedef *& precallback, AddByPointerTypedef * postcallback) { return 0; } void *typedef_call2(AddByPointerTypedef *& precallback, AddByPointerTypedef * postcallback) { return 0; }
void *typedef_call3(AddByReferenceTypedef *& precallback, AddByReferenceTypedef * 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; }
%} %}