Fix previous commit to compile with older compilers

Not all "C++11" compilers will also support C++17.
This commit is contained in:
Olly Betts 2017-08-04 17:01:35 +12:00
parent a92137a708
commit 6303a099aa
1 changed files with 10 additions and 0 deletions

View File

@ -8,14 +8,24 @@ static_assert(sizeof(int) >= 2, "What? int size is invalid!");
namespace dummy { namespace dummy {
// C++17 allows the message to be omitted, so check that works too. // C++17 allows the message to be omitted, so check that works too.
// But only show the C++17 version to SWIG, as the compiler may
// lack C++17 support.
#ifdef SWIG
static_assert(sizeof(int) >= sizeof(short)); static_assert(sizeof(int) >= sizeof(short));
#else
static_assert(sizeof(int) >= sizeof(short), "blah");
#endif
} }
template <typename T> template <typename T>
struct Check1 { struct Check1 {
static_assert(sizeof(int) <= sizeof(T), "not big enough"); static_assert(sizeof(int) <= sizeof(T), "not big enough");
Check1() { Check1() {
#ifdef SWIG
static_assert(true); static_assert(true);
#else
static_assert(true, "true");
#endif
} }
}; };