Skip to content
Snippets Groups Projects
Commit 71e13ea1 authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: non-dep structured binding decltype again [PR117107]

The patch for PR92687 handled the usual case of a decomp variable not being
in the table, but missed the case of there being nothing in the table yet.

	PR c++/117107
	PR c++/92687

gcc/cp/ChangeLog:

	* decl.cc (lookup_decomp_type): Handle null table.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/decomp10.C: New test.
parent 5c6c1aba
No related branches found
No related tags found
No related merge requests found
......@@ -9446,8 +9446,9 @@ static GTY((cache)) decl_tree_cache_map *decomp_type_table;
tree
lookup_decomp_type (tree v)
{
if (tree *slot = decomp_type_table->get (v))
return *slot;
if (decomp_type_table)
if (tree *slot = decomp_type_table->get (v))
return *slot;
return NULL_TREE;
}
 
......
// PR c++/117107
// { dg-do compile { target c++11 } }
// { dg-options "" }
template <typename, typename>
constexpr bool is_same = false; // { dg-warning "variable template" "" { target c++11_down } }
template <typename T>
constexpr bool is_same<T, T> = true; // { dg-warning "variable template" "" { target c++11_down } }
struct tuple {
template <unsigned long I>
void check_tuple_like() {
tuple t;
auto [v, r] = t; // { dg-warning "structured bindings" "" { target c++14_down } }
(void)[v, r] { // { dg-warning "captured structured" "" { target c++17_down } }
decltype(v) x;
};
}
int a = 0;
int &b = a;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment