Allow C++11 "explicit constexpr"

This commit is contained in:
Olly Betts 2015-01-08 15:56:50 +13:00
commit 87bdaa3910
3 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.4 (in progress) Version 3.0.4 (in progress)
=========================== ===========================
2015-01-08: olly
Allow C++11 "explicit constexpr". Fixes github issue#284 reported
by Paweł Tomulik.
2015-01-08: olly 2015-01-08: olly
When reporting an error for a construct which hasn't been When reporting an error for a construct which hasn't been
terminated when the end of the file is reached, report it at the terminated when the end of the file is reached, report it at the

View file

@ -18,6 +18,8 @@ struct ConstExpressions {
static const int LLL = 300; static const int LLL = 300;
constexpr int MMM() { return 400; } constexpr int MMM() { return 400; }
constexpr const int NNN() { return 500; } constexpr const int NNN() { return 500; }
// Regression test for https://github.com/swig/swig/issues/284 :
explicit constexpr ConstExpressions(int) { }
}; };
%} %}

View file

@ -4680,6 +4680,7 @@ storage_class : EXTERN { $$ = "extern"; }
| FRIEND { $$ = "friend"; } | FRIEND { $$ = "friend"; }
| EXPLICIT { $$ = "explicit"; } | EXPLICIT { $$ = "explicit"; }
| CONSTEXPR { $$ = "constexpr"; } | CONSTEXPR { $$ = "constexpr"; }
| EXPLICIT CONSTEXPR { $$ = "explicit constexpr"; }
| STATIC CONSTEXPR { $$ = "static constexpr"; } | STATIC CONSTEXPR { $$ = "static constexpr"; }
| THREAD_LOCAL { $$ = "thread_local"; } | THREAD_LOCAL { $$ = "thread_local"; }
| THREAD_LOCAL STATIC { $$ = "static thread_local"; } | THREAD_LOCAL STATIC { $$ = "static thread_local"; }