Commit e3a661b4 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/83217 (Compiler segfault: structured binding by reference to a…

re PR c++/83217 (Compiler segfault: structured binding by reference to a templated type via a pointer)

	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
parent 32151c3f
2017-12-15 Jakub Jelinek <jakub@redhat.com> 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 * tree.c (cxx_attribute_table, std_attribute_table): Swap
affects_type_identity and handler fields, adjust comments. affects_type_identity and handler fields, adjust comments.
......
...@@ -7404,7 +7404,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count) ...@@ -7404,7 +7404,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
{ {
dexp = convert_from_reference (dexp); 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; tree eltype = NULL_TREE;
......
2017-12-15 Jakub Jelinek <jakub@redhat.com> 2017-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/83217
* g++.dg/cpp1z/decomp33.C: New test.
PR tree-optimization/80631 PR tree-optimization/80631
* gcc.target/i386/avx2-pr80631.c: New test. * gcc.target/i386/avx2-pr80631.c: New test.
......
// 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 } }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment