================
@@ -155,3 +155,128 @@ constexpr auto [e1] = E(true);
 //   expected-note@-1 {{in implicit initialization of binding declaration 
'e1'}} \
 //   expected-note@-1 {{reference to temporary is not a constant expression}} \
 //   expected-note@#E-get {{temporary created here}}
+
+namespace GH170991 {
+// Test case: struct
+struct S { int x{}; };
+
+template <typename = void>
+void f() {
+  constexpr S s;
+  constexpr auto [x] = s;
+  constexpr auto [...xs] = s;
+}
+
+template void f<void>();
+
+// Test case: array
+template <typename = void>
+void g() {
+  constexpr int a[2]{};
+  constexpr auto [x, y] = a;
+  constexpr auto [...xs] = a;
+}
+
+template void g<void>();
+} // namespace GH170991
+
+// Test case: tuple-like
+namespace GH170991 {
+struct TupleLikeFnTemplate {
+  int x = 100;
+  char y = 'D';
+
+  // If a search for the name get in the scope of E [...] the initializer is 
e.get<i>()
+  template <unsigned I>
+  constexpr decltype(auto) get() const& {
----------------
babadany2999 wrote:

Reference is unnecessary.

https://github.com/llvm/llvm-project/pull/213534
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to