[PATCH] D85613: [clang] Look through bindings when checking whether a default argument references a local entity.

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 07:39:29 PDT 2020


riccibruno added inline comments.


================
Comment at: clang/include/clang/AST/DeclCXX.h:3843
   /// The declaration that this binding binds to part of.
+  // FIXME: Currently not set during deserialization of the BindingDecl;
+  // only set when the corresponding DecompositionDecl is visited.
----------------
rsmith wrote:
> !! This seems pretty bad; would it be hard to fix?
On further examination, I believe that`Decomp` is set but this is subtle, and it is likely that I am missing a case/wrong somehow.

The expression for the binding (`Binding`) will be deserialized when visiting the `BindingDecl`. This expression when non-null will always (as far as I can tell) contain a reference to the decomposition declaration so the decomposition will be deserialized, which will set `Decomp`.

The binding expression is null when the initializer is type-dependent. But then, since variable template decompositions are not allowed, the decomposition must occurs at block scope (`mayHaveDecompositionDeclarator`). This means that the `DecompositionDecl` will be read first.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85613



More information about the cfe-commits mailing list