[PATCH] D86649: Fix for assertion failure on PR46865

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 27 21:19:56 PDT 2020


rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.

I think the assertion is correct: if we reach this point, then we have a `DeclRefExpr` that is not value-dependent and refers to a declaration whose initializer is value-dependent. That should never happen if the variable's type satisfies the requirements for use in a constant expression, which is what `mightBeUsableInConstantExpressions` checks.

The bug here appears to be that the dependency bits on a `DeclRefExpr` are computed too early when it refers to a templated variable -- before we instantiate the initializer -- and don't get "fixed" later when the initializer is instantiated. `DoMarkVarDeclReferenced` would be the right place to handle this -- after we trigger instantiation of the initializer, we should recompute the dependence bits on the `DeclRefExpr`, because they can depend on the initializer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86649



More information about the cfe-commits mailing list