return error_mark_node;
}
- if (cxx_dialect < cxx20)
+ if (cxx_dialect < cxx20 && !explicit_init_p)
{
auto_diagnostic_group d;
tree stripped_init = tree_strip_any_location_wrapper (initializer);
--- /dev/null
+// PR c++/118719
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+int
+main ()
+{
+ int a[] = { 42 };
+ auto [x] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+ // { dg-message "declared here" "" { target c++17_down } .-1 }
+ [=] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
+ [&] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
+ [x] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
+ [&x] () { int b = x; (void) b; }; // { dg-warning "captured structured bindings are a C\\\+\\\+20 extension" "" { target c++17_down } }
+ [x = x] () { int b = x; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
+ [y = x] () { int b = y; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
+ [y = x * 2] () { int b = y; (void) b; }; // { dg-warning "lambda capture initializers only available with" "" { target c++11_only } }
+}