Fix c++ compiler warnings in c++11 testcases

This commit is contained in:
William S Fulton 2017-06-03 17:15:44 +01:00
commit be63f73e33
6 changed files with 31 additions and 10 deletions

View file

@ -13,6 +13,7 @@ struct SomeStruct {
auto addAlternateMemberPtrConstParm(int x, int (SomeStruct::*mp)(int, int) const) const -> int;
virtual auto addFinal(int x, int y) const noexcept -> int final { return x + y; }
virtual ~SomeStruct() = default;
};
int SomeStruct::addNormal(int x, int y) { return x + y; }

View file

@ -3,11 +3,17 @@
*/
%module cpp11_constexpr
%inline %{
#ifdef SWIG
#define CONST const
#else
#define CONST
#endif
constexpr int AAA = 10;
constexpr const int BBB = 20;
constexpr int CCC() { return 30; }
constexpr const int DDD() { return 40; }
constexpr CONST int DDD() { return 40; }
constexpr int XXX() { return 10; }
constexpr int YYY = XXX() + 100;
@ -17,7 +23,7 @@ struct ConstExpressions {
static constexpr int KKK = 200;
static const int LLL = 300;
constexpr int MMM() { return 400; }
constexpr const int NNN() { return 500; }
constexpr CONST int NNN() { return 500; }
// Regression tests for support added in SWIG 3.0.4:
static constexpr const int JJJ1 = 101;
constexpr static int KKK1 = 201;

View file

@ -82,6 +82,7 @@ struct Destructors4 : Base {
struct FinalOverrideMethods {
virtual void final() {}
virtual void override(int) {}
virtual ~FinalOverrideMethods() = default;
};
struct FinalOverrideVariables {
int final;

View file

@ -18,7 +18,7 @@ struct NoExceptClass {
NoExceptClass(const NoExceptClass&) noexcept {}
NoExceptClass(NoExceptClass&&) noexcept {}
NoExceptClass& operator=(const NoExceptClass&) noexcept { return *this; }
~NoExceptClass() noexcept {}
virtual ~NoExceptClass() noexcept {}
void noex0() noexcept {}
void noex1() noexcept(sizeof(int) == 4) {}

View file

@ -23,7 +23,7 @@ struct Thingy {
int val;
int &lvalref;
int &&rvalref;
Thingy(int v) : val(v), lvalref(val), rvalref(22) {}
Thingy(int v, int &&rvalv) : val(v), lvalref(val), rvalref(std::move(rvalv)) {}
void refIn(long &i) {}
void rvalueIn(long &&i) {}
short && rvalueInOut(short &&i) { return std::move(i); }
@ -32,7 +32,7 @@ struct Thingy {
void compactDefaultArgs(const bool &&b = (const bool &&)PublicGlobalTrue, const UserDef &&u = (const UserDef &&)PublicUserDef) {}
void privateDefaultArgs(const bool &&b = (const bool &&)PrivateTrue) {}
operator int &&() { return std::move(0); }
Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(copy_int(rhs.rvalref)) {}
Thingy(const Thingy& rhs) : val(rhs.val), lvalref(rhs.lvalref), rvalref(std::move(rhs.rvalref)) {}
Thingy& operator=(const Thingy& rhs) {
val = rhs.val;
lvalref = rhs.lvalref;
@ -41,17 +41,18 @@ struct Thingy {
}
private:
static const bool PrivateTrue;
int copy_int(int& i) { return i; }
Thingy();
};
const bool Thingy::PrivateTrue = true;
short && globalRvalueInOut(short &&i) { return std::move(i); }
Thingy &&globalrrval = Thingy(55);
int glob = 123;
Thingy &&globalrrval = Thingy(55, std::move(glob));
short && func(short &&i) { return std::move(i); }
Thingy getit() { return Thingy(22); }
Thingy getit() { return Thingy(22, std::move(glob)); }
void rvalrefFunction1(int &&v = (int &&)5) {}
void rvalrefFunctionBYVAL(short (Thingy::*memFunc)(short)) {}

View file

@ -31,7 +31,13 @@ struct Containing {
Thing *const&& member_rvalue_ref_ptr3 = 0;
Thing const*const &&member_rvalue_ref_ptr4 = 0;
Containing() : member_rvalue_ref(Thing()) {}
Containing(Thing&&r, Thing*&& r1, Thing const*&& r2, Thing *const&& r3, Thing const*const && r4) :
member_rvalue_ref(std::move(r)),
member_rvalue_ref_ptr1(std::move(r1)),
member_rvalue_ref_ptr2(std::move(r2)),
member_rvalue_ref_ptr3(std::move(r3)),
member_rvalue_ref_ptr4(std::move(r4))
{}
};
%}
@ -62,6 +68,12 @@ struct IntContaining {
int *const&& member_rvalue_ref_ptr3 = 0;
int const*const &&member_rvalue_ref_ptr4 = 0;
IntContaining() : member_rvalue_ref(55) {}
IntContaining(int&& r, int*&& r1, int const*&& r2, int *const&& r3, int const*const && r4) :
member_rvalue_ref(std::move(r)),
member_rvalue_ref_ptr1(std::move(r1)),
member_rvalue_ref_ptr2(std::move(r2)),
member_rvalue_ref_ptr3(std::move(r3)),
member_rvalue_ref_ptr4(std::move(r4))
{}
};
%}