r348037 - [ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 30 13:15:41 PST 2018


Author: maskray
Date: Fri Nov 30 13:15:41 2018
New Revision: 348037

URL: http://llvm.org/viewvc/llvm-project?rev=348037&view=rev
Log:
[ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)

Summary:
Reinstate the original behavior (Success(false, E)) before D54355 when this branch is
taken. This fixes spurious error of the following snippet:

  extern char extern_var;
  struct { int a; } a = {__builtin_constant_p(extern_var)};

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=348037&r1=348036&r2=348037&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Nov 30 13:15:41 2018
@@ -8199,7 +8199,6 @@ bool IntExprEvaluator::VisitBuiltinCallE
       // We can delay calculation of __builtin_constant_p until after
       // inlining. Note: This diagnostic won't be shown to the user.
       Info.FFDiag(E, diag::note_invalid_subexpr_in_const_expr);
-      return false;
     }
     return Success(false, E);
   }




More information about the cfe-commits mailing list