summaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp11_constexpr.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/cpp11_constexpr.i')
-rw-r--r--Examples/test-suite/cpp11_constexpr.i9
1 files changed, 5 insertions, 4 deletions
diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i
index a77248069..bb14de526 100644
--- a/Examples/test-suite/cpp11_constexpr.i
+++ b/Examples/test-suite/cpp11_constexpr.i
@@ -45,9 +45,7 @@ struct ConstExpressions {
constexpr friend bool operator==(ConstExpressions,ConstExpressions) { return true; }
friend constexpr bool operator!=(ConstExpressions,ConstExpressions) { return false; }
};
-%}
-%{
int Array10[AAA];
int Array20[BBB];
int Array30[CCC()];
@@ -61,9 +59,12 @@ int Array300[ConstExpressions::LLL];
// Regression test for https://github.com/swig/swig/issues/2486 fixed in 4.2.0
// (the array size is constexpr in C++11):
unsigned char myarray[std::numeric_limits<unsigned char>::max()];
-%}
+// Also check that `<(` and `)>` in the expression are handled, since these have
+// special meanings for SWIG's type system. SWIG should rewrite them as `< (`
+// and `) >` here to avoid problems.
+template<int N> constexpr int inc() { return N + 1; };
+unsigned char myarray2[inc<(1)>()];
-%{
// Test handling of ID PERIOD ID in constant expressions (supported since 4.1.0).
struct A {
int i;