r311115 - PR34161: support evaluation of 'void()' expressions in C++14 onwards.

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 13:29:11 PDT 2017


Merged to 5.0 in r311194.

On Thu, Aug 17, 2017 at 12:35 PM, Richard Smith via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> 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);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list