mirror of https://github.com/swig/swig
testcase fixes for gcc-9
This commit is contained in:
parent
6791f8b769
commit
4e5d1891e6
|
@ -43,14 +43,17 @@ auto lambda1 = [](int x, int y) -> int { return x+y; };
|
|||
single statement "return expr;". */
|
||||
auto lambda2 = [](int x, int y) { return x+y; };
|
||||
|
||||
auto lambda3 = [&](int x, int y) { return x+y; };
|
||||
auto lambda4 = [=](int x, int y) { return x+y; };
|
||||
int thing = 0;
|
||||
#ifdef SWIG
|
||||
// Not strictly correct as captured variables should have non-automatic storage duration, ie shouldn't capture globals. gcc-4.7 warns about this, but we check that SWIG can parse this anyway.
|
||||
// This is not strictly legal: non-local lambda expression cannot have a capture-default
|
||||
// gcc-4.7 warns about this and gcc-9 gives an error, but we check that SWIG can parse this anyway.
|
||||
auto lambda3 = [&](int x, int y) { return x+y; };
|
||||
auto lambda4 = [=](int x, int y) { return x+y; };
|
||||
auto lambda5 = [=,&thing]() { return thing; };
|
||||
#else
|
||||
auto lambda5 = [=]() { return thing; };
|
||||
auto lambda3 = [](int x, int y) { return x+y; };
|
||||
auto lambda4 = [](int x, int y) { return x+y; };
|
||||
auto lambda5 = []() { return thing; };
|
||||
#endif
|
||||
|
||||
void fn() {
|
||||
|
@ -115,6 +118,6 @@ int runLambdaInline() {
|
|||
// TODO
|
||||
int(*lambda101notauto)(int, int) = [] (int a, int b) { return a + b; };
|
||||
int lambda102 = [] (int a, int b) mutable { return a + b; }(1, 2);
|
||||
void lambda_init(int = ([=]{ return 0; })());
|
||||
void lambda_init(int = ([]{ return 0; })());
|
||||
%}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ public class rename1_runme {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
{
|
||||
XYZDouble xyz = new XYZDouble();
|
||||
|
@ -36,7 +35,6 @@ public class rename1_runme {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
{
|
||||
XYZKlass xyz = new XYZKlass();
|
||||
|
@ -48,7 +46,6 @@ public class rename1_runme {
|
|||
xyz.tMethod3(new Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
{
|
||||
XYZEnu xyz = new XYZEnu();
|
||||
|
@ -60,7 +57,6 @@ public class rename1_runme {
|
|||
xyz.tMethod4(Enu.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
{
|
||||
ABC abc = new ABC();
|
||||
|
|
|
@ -24,7 +24,6 @@ public class rename2_runme {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
{
|
||||
XYZDouble xyz = new XYZDouble();
|
||||
|
@ -36,7 +35,6 @@ public class rename2_runme {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
{
|
||||
XYZKlass xyz = new XYZKlass();
|
||||
|
@ -48,7 +46,6 @@ public class rename2_runme {
|
|||
xyz.tMethod3(new Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
{
|
||||
XYZEnu xyz = new XYZEnu();
|
||||
|
@ -60,7 +57,6 @@ public class rename2_runme {
|
|||
xyz.tMethod4(Enu.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
{
|
||||
ABC abc = new ABC();
|
||||
|
|
|
@ -24,7 +24,6 @@ public class rename3_runme {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
{
|
||||
XYZDouble xyz = new XYZDouble();
|
||||
|
@ -36,7 +35,6 @@ public class rename3_runme {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
{
|
||||
XYZKlass xyz = new XYZKlass();
|
||||
|
@ -48,7 +46,6 @@ public class rename3_runme {
|
|||
xyz.tMethod3(new Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
{
|
||||
XYZEnu xyz = new XYZEnu();
|
||||
|
@ -60,7 +57,6 @@ public class rename3_runme {
|
|||
xyz.tMethod4(Enu.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
{
|
||||
ABC abc = new ABC();
|
||||
|
|
|
@ -24,7 +24,6 @@ public class rename4_runme {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
{
|
||||
XYZDouble xyz = new XYZDouble();
|
||||
|
@ -36,7 +35,6 @@ public class rename4_runme {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
{
|
||||
XYZKlass xyz = new XYZKlass();
|
||||
|
@ -48,7 +46,6 @@ public class rename4_runme {
|
|||
xyz.tMethod3(new Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
{
|
||||
XYZEnu xyz = new XYZEnu();
|
||||
|
@ -60,7 +57,6 @@ public class rename4_runme {
|
|||
xyz.tMethod4(Enu.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
{
|
||||
ABC abc = new ABC();
|
||||
|
|
|
@ -10,7 +10,6 @@ function part1() {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
|
||||
function part2() {
|
||||
|
@ -23,7 +22,6 @@ function part2() {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
|
||||
function part3(){
|
||||
|
@ -36,7 +34,6 @@ function part3(){
|
|||
xyz.tMethod3(new rename.Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
|
||||
function part4() {
|
||||
|
@ -49,7 +46,6 @@ function part4() {
|
|||
xyz.tMethod4(rename.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
|
||||
function part5() {
|
||||
|
|
|
@ -10,7 +10,6 @@ function part1() {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
|
||||
function part2() {
|
||||
|
@ -23,7 +22,6 @@ function part2() {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
|
||||
function part3(){
|
||||
|
@ -36,7 +34,6 @@ function part3(){
|
|||
xyz.tMethod3(new rename.Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
|
||||
function part4() {
|
||||
|
@ -49,7 +46,6 @@ function part4() {
|
|||
xyz.tMethod4(rename.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
|
||||
function part5() {
|
||||
|
|
|
@ -10,7 +10,6 @@ function part1() {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
|
||||
function part2() {
|
||||
|
@ -23,7 +22,6 @@ function part2() {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
|
||||
function part3(){
|
||||
|
@ -36,7 +34,6 @@ function part3(){
|
|||
xyz.tMethod3(new rename.Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
|
||||
function part4() {
|
||||
|
@ -49,7 +46,6 @@ function part4() {
|
|||
xyz.tMethod4(rename.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
|
||||
function part5() {
|
||||
|
|
|
@ -10,7 +10,6 @@ function part1() {
|
|||
xyz.tMethod2(0);
|
||||
xyz.tMethodNotXYZ2(notxyz);
|
||||
xyz.opNotXYZ2();
|
||||
xyz.opXYZ2();
|
||||
}
|
||||
|
||||
function part2() {
|
||||
|
@ -23,7 +22,6 @@ function part2() {
|
|||
xyz.tMethod1(0);
|
||||
xyz.tMethodNotXYZ1(notxyz);
|
||||
xyz.opNotXYZ1();
|
||||
xyz.opXYZ1();
|
||||
}
|
||||
|
||||
function part3(){
|
||||
|
@ -36,7 +34,6 @@ function part3(){
|
|||
xyz.tMethod3(new rename.Klass());
|
||||
xyz.tMethodNotXYZ3(notxyz);
|
||||
xyz.opNotXYZ3();
|
||||
xyz.opXYZ3();
|
||||
}
|
||||
|
||||
function part4() {
|
||||
|
@ -49,7 +46,6 @@ function part4() {
|
|||
xyz.tMethod4(rename.En1);
|
||||
xyz.tMethodNotXYZ4(notxyz);
|
||||
xyz.opNotXYZ4();
|
||||
xyz.opXYZ4();
|
||||
}
|
||||
|
||||
function part5() {
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace Space {
|
|||
void templateXYZ(XYZ<T> i) {}
|
||||
operator T() { return m_t; }
|
||||
operator NotXYZ<T>() const { return m_notxyz; }
|
||||
operator XYZ<T>() const { XYZ<T> xyz = XYZ<T>(); return xyz; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -48,10 +47,7 @@ class ABC {
|
|||
public:
|
||||
void method(ABC a) const {}
|
||||
void method(Klass k) const {}
|
||||
#if !defined(__clang__)
|
||||
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||
operator ABC() const { ABC a; return a; }
|
||||
#endif
|
||||
operator ABC*() const { return new ABC(); }
|
||||
operator Klass() const { Klass k; return k; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -35,14 +35,9 @@
|
|||
%rename(opNotXYZ3) Space::XYZ<Space::Klass>::operator NotXYZ<Space::Klass>() const;
|
||||
%rename(opNotXYZ4) Space::XYZ<Space::Enu>::operator NotXYZ<Space::Enu>() const;
|
||||
|
||||
%rename(opXYZ1) Space::XYZ::operator XYZ<T>() const;
|
||||
%rename(opXYZ2) Space::XYZ<int>::operator XYZ<int>() const;
|
||||
%rename(opXYZ3) Space::XYZ<Space::Klass>::operator XYZ<Space::Klass>() const;
|
||||
%rename(opXYZ4) Space::XYZ<Space::Enu>::operator XYZ<Space::Enu>() const;
|
||||
|
||||
|
||||
%rename(methodABC) Space::ABC::method(ABC a) const;
|
||||
%rename(opABC) Space::ABC::operator ABC() const;
|
||||
%rename(opABC) Space::ABC::operator ABC*() const;
|
||||
%rename(methodKlass) Space::ABC::method(Klass k) const;
|
||||
%rename(opKlass) Space::ABC::operator Klass() const;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Space {
|
|||
|
||||
|
||||
%rename(methodABC) ABC::method(ABC a) const;
|
||||
%rename(opABC) ABC::operator ABC() const;
|
||||
%rename(opABC) ABC::operator ABC*() const;
|
||||
%rename(methodKlass) ABC::method(Klass k) const;
|
||||
%rename(opKlass) ABC::operator Klass() const;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Space {
|
|||
|
||||
%extend ABC {
|
||||
%rename(methodABC) method(ABC a) const;
|
||||
%rename(opABC) operator ABC() const;
|
||||
%rename(opABC) operator ABC*() const;
|
||||
%rename(methodKlass) method(Klass k) const;
|
||||
%rename(opKlass) operator Klass() const;
|
||||
}
|
||||
|
|
|
@ -29,21 +29,18 @@ namespace Space {
|
|||
%rename(tMethodXYZ2) templateXYZ(XYZ<int>);
|
||||
%rename(opT2) operator int();
|
||||
%rename(opNotXYZ2) operator NotXYZ<int>() const;
|
||||
%rename(opXYZ2) operator XYZ<int>() const;
|
||||
|
||||
%rename(tMethod3) templateT(Space::Klass i);
|
||||
%rename(tMethodNotXYZ3) templateNotXYZ(NotXYZ<Space::Klass>);
|
||||
%rename(tMethodXYZ3) templateXYZ(XYZ<Space::Klass>);
|
||||
%rename(opT3) operator Space::Klass();
|
||||
%rename(opNotXYZ3) operator NotXYZ<Space::Klass>() const;
|
||||
%rename(opXYZ3) operator XYZ<Space::Klass>() const;
|
||||
|
||||
%rename(tMethod4) templateT(Space::Enu i);
|
||||
%rename(tMethodNotXYZ4) templateNotXYZ(NotXYZ<Space::Enu>);
|
||||
%rename(tMethodXYZ4) templateXYZ(XYZ<Space::Enu>);
|
||||
%rename(opT4) operator Space::Enu();
|
||||
%rename(opNotXYZ4) operator NotXYZ<Space::Enu>() const;
|
||||
%rename(opXYZ4) operator XYZ<Space::Enu>() const;
|
||||
|
||||
namespace Space {
|
||||
using namespace AnotherSpace;
|
||||
|
@ -60,7 +57,6 @@ namespace Space {
|
|||
%rename(tMethodXYZ1) templateXYZ(XYZ<T>);
|
||||
%rename(opT1) operator T();
|
||||
%rename(opNotXYZ1) operator NotXYZ<T>() const;
|
||||
%rename(opXYZ1) operator XYZ<T>() const;
|
||||
|
||||
NotXYZ<int> *m_int;
|
||||
T m_t;
|
||||
|
@ -74,7 +70,6 @@ namespace Space {
|
|||
void templateXYZ(XYZ<T> i) {}
|
||||
operator T() { return m_t; }
|
||||
operator NotXYZ<T>() const { return m_notxyz; }
|
||||
operator XYZ<T>() const { XYZ<T> xyz; return xyz; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -93,16 +88,13 @@ class ABC {
|
|||
public:
|
||||
|
||||
%rename(methodABC) method(ABC a) const;
|
||||
%rename(opABC) operator ABC() const;
|
||||
%rename(opABC) operator ABC*() const;
|
||||
%rename(methodKlass) method(Klass k) const;
|
||||
%rename(opKlass) operator Klass() const;
|
||||
|
||||
void method(ABC a) const {}
|
||||
void method(Klass k) const {}
|
||||
#if !defined(__clang__)
|
||||
// Workaround for: warning: conversion function converting 'Space::ABC' to itself will never be used
|
||||
operator ABC() const { ABC a; return a; }
|
||||
#endif
|
||||
operator ABC*() const { return new ABC(); }
|
||||
operator Klass() const { Klass k; return k; }
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue