summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2015-01-09 11:47:40 +1300
committerOlly Betts <olly@survex.com>2015-01-09 11:47:40 +1300
commitbfa570e404d1808d8b2f4c6b39fc5829d9aafeaa (patch)
tree8073b4cf8b66ead28ea150c5da6f95f14ba6ee7a
parent87bdaa3910ebf9ba74704f9753970a83906e7507 (diff)
downloadswig-bfa570e404d1808d8b2f4c6b39fc5829d9aafeaa.tar.gz
Handle "constexpr explicit" and "constexpr static"
-rw-r--r--CHANGES.current3
-rw-r--r--Examples/test-suite/cpp11_constexpr.i6
-rw-r--r--Source/CParse/parser.y2
3 files changed, 9 insertions, 2 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 880453b53..50de69c90 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,7 +7,8 @@ Version 3.0.4 (in progress)
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue#284 reported
- by Paweł Tomulik.
+ by Paweł Tomulik. Also handle "constexpr explicit" and "constexpr
+ static".
2015-01-08: olly
When reporting an error for a construct which hasn't been
diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i
index d8de0ae1d..d91107cc6 100644
--- a/Examples/test-suite/cpp11_constexpr.i
+++ b/Examples/test-suite/cpp11_constexpr.i
@@ -18,8 +18,12 @@ struct ConstExpressions {
static const int LLL = 300;
constexpr int MMM() { return 400; }
constexpr const int NNN() { return 500; }
- // Regression test for https://github.com/swig/swig/issues/284 :
+ // Regression tests for support added in SWIG 3.0.4:
+ static constexpr const int JJJ1 = 101;
+ constexpr static int KKK1 = 201;
+ // Regression tests for https://github.com/swig/swig/issues/284 :
explicit constexpr ConstExpressions(int) { }
+ constexpr explicit ConstExpressions(double) { }
};
%}
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 5e4dc24d7..4f48b62ff 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -4681,7 +4681,9 @@ storage_class : EXTERN { $$ = "extern"; }
| EXPLICIT { $$ = "explicit"; }
| CONSTEXPR { $$ = "constexpr"; }
| EXPLICIT CONSTEXPR { $$ = "explicit constexpr"; }
+ | CONSTEXPR EXPLICIT { $$ = "explicit constexpr"; }
| STATIC CONSTEXPR { $$ = "static constexpr"; }
+ | CONSTEXPR STATIC { $$ = "static constexpr"; }
| THREAD_LOCAL { $$ = "thread_local"; }
| THREAD_LOCAL STATIC { $$ = "static thread_local"; }
| STATIC THREAD_LOCAL { $$ = "static thread_local"; }