r311115 - PR34161: support evaluation of 'void()' expressions in C++14 onwards.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 17 12:35:50 PDT 2017
Author: rsmith
Date: Thu Aug 17 12:35:50 2017
New Revision: 311115
URL: http://llvm.org/viewvc/llvm-project?rev=311115&view=rev
Log:
PR34161: support evaluation of 'void()' expressions in C++14 onwards.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=311115&r1=311114&r2=311115&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Aug 17 12:35:50 2017
@@ -9787,6 +9787,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:
Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp?rev=311115&r1=311114&r2=311115&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp Thu Aug 17 12:35:50 2017
@@ -982,3 +982,9 @@ constexpr void PR28739(int n) { // expec
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);
More information about the cfe-commits
mailing list