Particularly when using virtual inheritance as the pointers weren't
correctly upcast from derived class to base class when stored in the
base's proxy class.
Fixes commented out test code in cpp11_std_unique_ptr_runme
and li_std_auto_ptr_runme D tests.
I don't think any valid C program can contain `<=>` in a tokenisable
context, but it's more helpful to fail with a syntax error at SWIG
parse time and not potentially generate C code trying to use `<=>` in
an expression which then fails at compile time.
Remove some erroneously added brackets_increment() calls.
Reject <=> in preprocessor expressions with a clear error message (it
seems it isn't supported here - clang and gcc don't at least).
The type returned by `<=>` is not `bool`. We pretend it's
`int` for now, which should work for how it's likely to be used
in constant expressions.
Fixes#1622
MSVC fails with:
cpp11_result_of_wrap.cxx(3211): error C2672: 'test_result_impl': no matching overloaded function found
cpp11_result_of_wrap.cxx(3211): error C2893: Failed to specialize function template 'std::result_of<Fun(Arg)>::type test_result_impl(Fun,Arg)'
cpp11_result_of_wrap.cxx(3150): note: see declaration of 'test_result_impl'
cpp11_result_of_wrap.cxx(3211): note: With the following template arguments:
cpp11_result_of_wrap.cxx(3211): note: 'Fun=double (__cdecl *)(double)'
cpp11_result_of_wrap.cxx(3211): note: 'Arg=int'
Try making the second parameter double to match the template.
MSVC now fails with:
error C4596: 'foo': illegal qualified name in member declaration
Such redundant qualification is invalid. Compilers used to be
permissive here (so it's useful for SWIG to handle it), but compilers
increasingly complain about it so adjust the testcase to show the
compiler a valid version, and only test the redundant qualification
with SWIG.
MSVC in C++20 mode complains:
error C7626: unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes
The struct member in question isn't actually used by the testcase, so
just remove it.
Previously these testcases had C++98 fallback versions of the
testcase code to feed to the compiler if it didn't set __cplusplus to a
value which indicated support for the required C++ version, as well as
the C++14 or C++17 code which was fed to SWIG, and also to the compiler
if it was new enough.
This approach allowed some testing of such features with an
older compiler, but it complicates the testcases and not all new
C++ features can be tested in this way (indeed some of the existing
testcases don't fully exercise the feature being tested currently).
C++14 and C++17 support are also much more widespread than they
were 3.5 years ago when this approach was first implemented, so
it makes more sense to switch C++14 and C++17 testcases to require
a suitable compiler, like how C++11 testing always has.
Support running testcases conditional on the compiler supporting
a each language version, like we already handle C++11.
Currently no testcases are actually run in this way for these
newer language versions.
Most of these test D_d twice when they really should be testing
D_d once and D_i once (the variable name is `di` and the values
assigned are integers).
This was wrong in the initial version for Python in
708021a809 and it looks like subsequent
additions for other languages have just copied that mistake.