diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-08-18 20:28:06 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-08-18 20:28:06 +0000 |
commit | 502461a8c938b8ccd464d8d79e3b098b84cae6d3 (patch) | |
tree | 67d7566730c4ab9f75d0f9cc9cf9bff675ac4b2a | |
parent | ae3d7833d0fdf5be7149a1708302dc8f4c0ef99b (diff) |
Merging r311115:
------------------------------------------------------------------------
r311115 | rsmith | 2017-08-17 12:35:50 -0700 (Thu, 17 Aug 2017) | 2 lines
PR34161: support evaluation of 'void()' expressions in C++14 onwards.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@311194 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ExprConstant.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/constant-expression-cxx1y.cpp | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 0c0c861e5d..a26b608082 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -9788,6 +9788,8 @@ public: bool Success(const APValue &V, const Expr *e) { return true; } + bool ZeroInitialization(const Expr *E) { return true; } + bool VisitCastExpr(const CastExpr *E) { switch (E->getCastKind()) { default: diff --git a/test/SemaCXX/constant-expression-cxx1y.cpp b/test/SemaCXX/constant-expression-cxx1y.cpp index ac4e0fd471..0c0cb0ec58 100644 --- a/test/SemaCXX/constant-expression-cxx1y.cpp +++ b/test/SemaCXX/constant-expression-cxx1y.cpp @@ -982,3 +982,9 @@ constexpr void PR28739(int n) { // expected-error {{never produces a constant}} int *p = &n; p += (__int128)(unsigned long)-1; // expected-note {{cannot refer to element 18446744073709551615 of non-array object in a constant expression}} } + +constexpr void Void(int n) { + void(n + 1); + void(); +} +constexpr int void_test = (Void(0), 1); |