rsmith added inline comments.

================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:101-105
+    if (const VarDecl *HoldingVar = Binding->getHoldingVar()) {
+      // C++20 [dcl.struct.bind]p4:
+      //   Each vi is the name [...] that refers to the object bound to ri 
[...]
+      Decl = HoldingVar;
+    } else {
----------------
Is there a reason to separate these two cases? (Could we just use the 
decomposed decl unconditionally?) Generally treating tuple-like decompositions 
differently from other kinds seems error-prone.


================
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'}}
 
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85613

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

Reply via email to