PR c++/83217
* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
call complete_type (TREE_TYPE (type)).
* g++.dg/cpp1z/decomp33.C: New test.
From-SVN: r255702
2017-12-15 Jakub Jelinek <jakub@redhat.com>
+ PR c++/83217
+ * decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
+ call complete_type (TREE_TYPE (type)).
+
* tree.c (cxx_attribute_table, std_attribute_table): Swap
affects_type_identity and handler fields, adjust comments.
if (TREE_CODE (type) == REFERENCE_TYPE)
{
dexp = convert_from_reference (dexp);
- type = TREE_TYPE (type);
+ type = complete_type (TREE_TYPE (type));
+ if (type == error_mark_node)
+ goto error_out;
}
tree eltype = NULL_TREE;
2017-12-15 Jakub Jelinek <jakub@redhat.com>
+ PR c++/83217
+ * g++.dg/cpp1z/decomp33.C: New test.
+
PR tree-optimization/80631
* gcc.target/i386/avx2-pr80631.c: New test.
--- /dev/null
+// PR c++/83217
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <typename T>
+struct S
+{
+ T a;
+};
+
+void
+foo (S<int> *b)
+{
+ auto & [c] = *b; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+}
+
+void
+bar (S<char> *d)
+{
+ auto [e] = *d; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+}