Handle "constexpr explicit" and "constexpr static"

This commit is contained in:
Olly Betts 2015-01-09 11:47:40 +13:00
commit bfa570e404
3 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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) { }
};
%}

View file

@ -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"; }