+2017-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81888
+ * parser.c (cp_parser_decomposition_declaration): Reject just
+ BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
+ than all such CONSTRUCTORs, and only if is_direct_init is true.
+
2017-11-27 Jason Merrill <jason@redhat.com>
* pt.c (primary_template_specialization_p): Rename from
if (initializer == NULL_TREE
|| (TREE_CODE (initializer) == TREE_LIST
&& TREE_CHAIN (initializer))
- || (TREE_CODE (initializer) == CONSTRUCTOR
+ || (is_direct_init
+ && BRACE_ENCLOSED_INITIALIZER_P (initializer)
&& CONSTRUCTOR_NELTS (initializer) != 1))
{
error_at (loc, "invalid initializer for structured binding "
+2017-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81888
+ * g++.dg/cpp1z/decomp30.C: Add a test for structured binding with
+ = {} and = { a, a } initializers.
+ * g++.dg/cpp1z/decomp31.C: New test.
+
2017-11-27 Michael Meissner <meissner@linux.vnet.ibm.com>
PR middle_end/82333
auto [l, m] = { a }; // { dg-error "deducing from brace-enclosed initializer list requires" }
auto [n, o] {}; // { dg-error "invalid initializer for structured binding declaration" }
auto [p, q] (); // { dg-error "invalid initializer for structured binding declaration" }
+auto [r, s] = {}; // { dg-error "deducing from brace-enclosed initializer list requires" }
+auto [t, u] = { a, a }; // { dg-error "deducing from brace-enclosed initializer list requires" }
--- /dev/null
+// PR c++/81888
+// { dg-do compile { target c++17 } }
+
+struct S {
+ bool s = true;
+};
+
+auto [a] = S{};
+
+template <class T>
+bool
+foo () noexcept
+{
+ auto [c] = T{};
+ return c;
+}
+
+const bool b = foo<S> ();