[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
Mon Aug 10 07:52:05 PDT 2020


riccibruno added inline comments.


================
Comment at: clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp:51
+  extern void h8a(int = sizeof(z)); // ok
+  extern void h8b(int = w);         // expected-error {{default argument references local variable 'w'}}
 
----------------
rsmith wrote:
> The diagnostic in this case is inconsistent with the non-tuple-like cases. I think this diagnostic is better; we should use the original `Decl` when producing the diagnostic, not the decomposed variable.
Right, let's just refer to the binding in all cases.


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