[C++11] Allow static_assert at the top level
And disallow it right after template<T>). Fixes https://github.com/swig/swig/issues/1031 reported by Artem V L.
This commit is contained in:
parent
46f7217c50
commit
a92137a708
4 changed files with 24 additions and 8 deletions
|
|
@ -1,12 +1,22 @@
|
|||
/* This test case checks whether SWIG correctly parses and ignores the
|
||||
keywords "static_assert()" inside the class or struct.
|
||||
/* This test case checks whether SWIG correctly parses and ignores
|
||||
"static_assert()" in various places.
|
||||
*/
|
||||
%module cpp11_static_assert
|
||||
|
||||
%inline %{
|
||||
static_assert(sizeof(int) >= 2, "What? int size is invalid!");
|
||||
|
||||
namespace dummy {
|
||||
// C++17 allows the message to be omitted, so check that works too.
|
||||
static_assert(sizeof(int) >= sizeof(short));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct Check1 {
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
Check1() {
|
||||
static_assert(true);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue