aaron.ballman added inline comments.

================
Comment at: clang/lib/AST/ExprConstant.cpp:13547-13551
+      if (auto ValD = Info.EvaluatingDecl.dyn_cast<const ValueDecl *>()) {
+        const VarDecl *VD = dyn_cast_or_null<VarDecl>(ValD);
+        if (VD && !VD->isConstexpr())
+          NotConstexprVar = true;
+      }
----------------
shafik wrote:
> shafik wrote:
> > aaron.ballman wrote:
> > > This seems to be equivalent unless I'm misunderstanding something about 
> > > the member dyn_cast.
> > I think the problem is that `PointerUnion` requires that it be one of the 
> > static types it was defined with and in this case that is `const ValueDecl 
> > *, const Expr *` but maybe I am missing something.
> It looks like the big difference is that in `doCastIfPossible(...)` we end up 
> calling `Self::isPossible(f)` which ends up in `PointerUnion::isPossible...)` 
> which uses `FirstIndexOfType` and if the template arguments don't contain the 
> type then it fail.
Whelp, TIL!

Then I guess I'd go with:

`if (const auto *VD = 
dyn_cast_or_null<VarDecl>(Info.EvaluatingDecl.dyn_cast<const ValueDecl *>))`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131874/new/

https://reviews.llvm.org/D131874

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to