================
@@ -19998,9 +20054,9 @@ bool Sema::DiagIfReachable(SourceLocation Loc, 
ArrayRef<const Stmt *> Stmts,
   // static data member is not syntactically a constant evaluated constant,
   // but nonetheless is always required to be a constant expression, so we
   // can skip diagnosing.
-  // FIXME: Using the mangling context here is a hack.
-  if (auto *VD = dyn_cast_or_null<VarDecl>(
-          ExprEvalContexts.back().ManglingContextDecl)) {
+  if (auto ContextDecl = currentEvaluationContext().ContextDecl;
+      auto *VD =
+          dyn_cast_or_null<VarDecl>(ContextDecl ? *ContextDecl : nullptr)) {
----------------
zyn0217 wrote:

dyn_cast_if_present, if we have to touch it anyway :)

https://github.com/llvm/llvm-project/pull/107942
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to