Commit graph

5,880 commits

Author SHA1 Message Date
William S Fulton
b18b75369c Fix seg fault using %template
Fix seg fault when instantiating templates with parameters that are function
parameters containing templates, such as:

              %template(MyC) C<int(std::vector<int>)>;

Closes #983
2023-01-03 23:53:34 +00:00
William S Fulton
2fc0edc4fd Instantiation of C++11 variadic function templates
Complete support for C++11 variadic function templates. Support was previously limited
to just one template parameter. Now zero or more template parameters are supported
in the %template instantiation.
2023-01-03 22:38:46 +00:00
William S Fulton
cdc08c9325 Move variadic function template tests to separate testcase 2023-01-03 21:26:12 +00:00
William S Fulton
20ff64217d Merge branch 'OCaml-rename_rstrip_encoder-using2-runtime-tests'
* OCaml-rename_rstrip_encoder-using2-runtime-tests:
  Complete copy of testcase from Python
  [OCaml] Runtime tests for rename_rstrip_encoder and using2
2022-12-30 23:49:34 +00:00
William S Fulton
b7f64c4da5 Complete copy of testcase from Python 2022-12-30 23:49:07 +00:00
William S Fulton
041ec79747 More variadic template testing
Test less conventional function ptr parameters
2022-12-30 22:31:56 +00:00
William S Fulton
004af63f3c Syntax error fixes parsing more elaborate parameter pack arguments
that are function pointers and member function pointers.

  template <typename... V> struct VariadicParms {
    void ParmsFuncPtrPtr(int (*)(V*...)) {}
    void ParmsFuncPtrPtrRef(int (*)(V*&...)) {}
    void ParmsFuncPtrPtrRValueRef(int (*)(V*&&...)) {}
    void ParmsFuncPtrRef(int (*)(V&...)) {}
    void ParmsFuncPtrRValueRef(int (*)(V&&...)) {}

    void ParmsMemFuncPtrPtr(int (KlassMemFuncs::*)(V*...)) {}
    void ParmsMemFuncPtrPtrRef(int (KlassMemFuncs::*)(V*&...)) {}
    void ParmsMemFuncPtrPtrRValueRef(int (KlassMemFuncs::*)(V*&&...)) {}
    void ParmsMemFuncPtrRef(int (KlassMemFuncs::*)(V&...)) {}
    void ParmsMemFuncPtrRValueRef(int (KlassMemFuncs::*)(V&&...)) {}
  };

  %template(VariadicParms0) VariadicParms<>;
  %template(VariadicParms1) VariadicParms<A>;

  Also in various other places such as within noexcept specifiers:

    template<typename T, typename... Args>
    void emplace(Args &&... args) noexcept(
        std::is_nothrow_constructible<T, Args &&...>::value);

Issue #1863
2022-12-30 00:19:02 +00:00
William S Fulton
674abaddbf Fix instantiation of variadic class templates
containing parameter pack arguments that are function pointers.

  template <typename... V> struct VariadicParms {
    void ParmsFuncPtrVal(int (*)(V...)) {}
  };

  %template(VariadicParms0) VariadicParms<>;
  %template(VariadicParms1) VariadicParms<A>;
2022-12-29 23:38:17 +00:00
William S Fulton
70837bbc26 Fix syntax error parsing variadic template parameter pack arguments
that are function pointers

Issue #1863
2022-12-23 16:25:50 +00:00
William S Fulton
f648e58cb1 Extend variadic template support to various type combinations 2022-12-22 21:23:44 +00:00
William S Fulton
67c4c2186c Support multiple arguments in variadic templates.
Remove warning SWIGWARN_CPP11_VARIADIC_TEMPLATE which was issued if more
than one argument was used for a variadic template.

SwigType enhancement: 'v.' now represents a variadic argument.
2022-12-22 21:23:39 +00:00
William S Fulton
8a24c19d26 Fix syntax error for misplaced Doxygen comment after struct/class member.
Fix syntax error using Doxygen member groups syntax, "///*}", when used after
final struct/class member.

Issue #1636
2022-12-06 21:31:38 +00:00
William S Fulton
dc04564023 Improved handling of Doxygen comments in parameter lists
Fix garbled Doxygen post comments in parameter lists.
Fix syntax error parsing a trailing Doxygen comment in parameter lists.

Closes #2023
2022-12-05 19:47:59 +00:00
Zackery Spytz
90dce1af3e [OCaml] Runtime tests for rename_rstrip_encoder and using2
Add runtime tests for rename_rstrip_encoder and using2.

They are based on the runtime tests that already exist for other
languages.
2022-12-04 19:37:22 -08:00
William S Fulton
f7b4127310 Fix syntax error parsing of Doxygen comments after last enum item
It is unconventional to have a doxygen comment after an enum item. It is
attached to the previous, that is, the enum item to match Doxygen behaviour.

Closes #1609
2022-12-03 10:09:37 +00:00
William S Fulton
24f75aa481 Fix parsing of unconventional Doxygen post comments for enum items.
Closes #1715
2022-12-03 09:49:42 +00:00
William S Fulton
1cdeb458de Testcase fix for -Wdelete-non-virtual-dtor 2022-12-02 22:47:14 +00:00
William S Fulton
05b93b1f06 Improved template template parameters support.
Previously, specifying more than one simple template template parameter
resulted in a parse error. Now multiple template template parameters are
working including instantiation with %template. Example:

  template <template<template<class> class, class> class Op, template<class> class X, class Y>
    class C { ... };

Closes #624
Closes #1021
2022-12-02 19:16:02 +00:00
William S Fulton
637e297672 Test case fix for std::complex and non-floating types deprecation
From Visual Studio 2022:

warning C4996: 'std::complex<int>::complex': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning.
2022-11-26 10:18:11 +00:00
William S Fulton
ecf05445b9 Test cases fix 2022-11-26 10:04:35 +00:00
William S Fulton
15692f0e89 Add missing testcase cpp11_template_parameters_decltype 2022-11-26 01:27:04 +00:00
William S Fulton
2a1711e436 Slightly better decltype() support for expressions
decltype now accepts C++ expressions instead of just an ID, such as:

  int i,j;
  ...  decltype(i+j) ...
  ...  decltype(&i) ...

These result in a warning for non-trivial expressions which SWIG cannot evaluate:

  Warning 344: Unable to deduce decltype for 'i+j'.

See 'Type Inference' in CPlusPlus.html for workarounds.

Issue #1589
Issue #1590
2022-11-26 01:16:20 +00:00
William S Fulton
9b91b24d6b Fix syntax error parsing unnamed template parameters with a default.
Closes #961
2022-11-25 08:37:39 +00:00
Olly Betts
81c6a63898 Fix undefined behaviour in parser
Fix undefined behaviour in swig's parser when handling default parameter
expressions containing method calls.

Fixes #2447
2022-11-25 09:51:58 +13:00
William S Fulton
5a8d58c3a7 Merge branch 'rtests2'
* rtests2:
  more r tests
  more r tests
  added testcase pointer_reference
  [PHP] Update docs for removal of -noproxy in SWIG 4.1.0

Conflicts:
	CHANGES.current
2022-11-23 21:12:07 +00:00
William S Fulton
e0904f44eb Restore testing template_expr testcase
Problems handling < and > in template parameters are now fixed.
Remove illegal C++ code (template typedefs) - replace with a function
using same template.
2022-11-23 07:32:12 +00:00
William S Fulton
ca5c68e544 Fix seg fault handling template parameter expressions containing '>='
Similar to previous commit

Issue #1037
2022-11-22 21:40:38 +00:00
William S Fulton
0341258af7 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
2022-11-22 08:37:35 +00:00
AndLLA
1dd31446ce more r tests 2022-11-20 18:52:00 +01:00
William S Fulton
4729cf2b1f Duplicate class template instantiations via %template changes
Named duplicate class template instantiations now issue a warning and are ignored.
Duplicate empty class template instantiations are quietly ignored.

The test cases are fixed for this new behaviour.

This commit is a pre-requisite for the near future so that the Python
builtin wrappers can correctly use the SwigType_namestr function without
generating duplicate symbol names.
2022-11-18 19:35:47 +00:00
AndLLA
a88995a11d more r tests 2022-11-16 22:17:25 +01:00
AndLLA
63821f1bb5 added testcase pointer_reference 2022-11-16 20:54:45 +01:00
William S Fulton
c0026d036a
Merge pull request #2430 from AndLLA/rtests
more tests for R
2022-11-06 17:17:33 +00:00
William S Fulton
62be0de3d0 Workaround for incomplete or/and keyword support in VC++ 2022-11-06 17:08:12 +00:00
AndLLA
db9df1b3be more tests for R 2022-11-05 20:43:15 +01:00
William S Fulton
86b3e60617 rename cpp14_enable_if_t to cpp17_enable_if_t
std::enable_if_t is in C++14, but std::is_integral_v
is in C++17
2022-11-05 17:13:30 +00:00
William S Fulton
52edda64c1 Fix infinite loop handling non-type template parameters
Fixes infinite loop due to () brackets in a non-type template
parameter containing an expression

Fixes #2418

Non-trivial expressions are still not qualified properly though.
2022-11-05 08:41:10 +00:00
William S Fulton
d6d83f4df4 Overloading fixes for R and rtypecheck typemap
- Fix for special variable $argtype expansion in rtypecheck typemap.
- Remove unnecessary () brackets when using rtypecheck typemap for
  single parameter functions.
- Add rtypecheck typemaps for shared_ptr so that NULL can be used
  in overloaded functions taking shared_ptr.
2022-11-05 08:40:26 +00:00
William S Fulton
f2da4f2ade Improve R wrapper error message calling overloaded methods
when incorrect types passed are passed to the overloaded methods.

Old unhelpful error message:
  Error in f(...) : could not find function "f"

Example of new improved error message:
  Error in use_count(k) :
    cannot find overloaded function for use_count with argtypes (NULL)
2022-11-05 08:40:19 +00:00
William S Fulton
9e7610f972 Fix memory leak in R shared_ptr wrappers
Fix leak when a cast up a class inheritance chain is
required.

Adds implementation of SWIG_ConvertPtrAndOwn for R.

Closes #2386
2022-11-05 08:32:05 +00:00
William S Fulton
24b0e68391 li_boost_shared_ptr testcase for R
Synchronise test with Python version of testcase
2022-11-05 08:02:59 +00:00
William S Fulton
ed09dd948f cpp11_attribute_specifiers testcase warning suppression 2022-11-05 08:02:59 +00:00
William S Fulton
1e99e4fe37 R shared_ptr testing
Enable more tests.
Use preferred member variable access.
2022-10-24 23:03:47 +01:00
AndLLA
76f004766d enable tests working after master merge 2022-10-24 23:03:47 +01:00
William S Fulton
d238d109c9 Whitespace cleanup in R testcase 2022-10-24 19:38:01 +01:00
William S Fulton
6c4dcbb8fe R shared_ptr fixes
Fix problems in shared_ptr wrappers where the class names were
not consistent when using the shared_ptr template or the actual
underlying type. Move $R_class substitution to typemaps.

Issue #2386
2022-10-24 19:37:56 +01:00
AndLLA
deb8664165 enable test for pointerreftest fixed by 752b7e8 2022-10-24 18:20:10 +01:00
AndLLA
0d0e369aaf switched implementation reference from java to python 2022-10-24 18:20:10 +01:00
AndLLA
b885c22f11 fixes from code review 2022-10-24 18:20:10 +01:00
AndLLA
ba96783d11 enable li_boost_shared_ptr in r-test-suite 2022-10-24 18:20:10 +01:00