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

c++: local class in nested generic lambda [PR109241]

In this testcase, the tree walk to look for bare parameter packs was
confused by finding a type with no TREE_BINFO.  But it should be fine that
it's unset; we already checked for unexpanded packs at parse time.

I also tried doing the partial instantiation of the local class, which is
probably the long-term direction we want to go, but for stage 4 let's go
with this safer change.

	PR c++/109241

gcc/cp/ChangeLog:

	* pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/lambda-generic-local-class2.C: New test.
parent cd0c433e
No related branches found
No related tags found
No related merge requests found
...@@ -4069,10 +4069,14 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) ...@@ -4069,10 +4069,14 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
case TAG_DEFN: case TAG_DEFN:
t = TREE_TYPE (t); t = TREE_TYPE (t);
if (CLASS_TYPE_P (t)) if (CLASS_TYPE_P (t))
/* Local class, need to look through the whole definition. */ {
for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t))) /* Local class, need to look through the whole definition.
cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r, TYPE_BINFO might be unset for a partial instantiation. */
ppd, ppd->visited); if (TYPE_BINFO (t))
for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r,
ppd, ppd->visited);
}
else else
/* Enum, look at the values. */ /* Enum, look at the values. */
for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l)) for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l))
......
// PR c++/109241
// { dg-do compile { target c++14 } }
// { dg-options "" } no pedantic
void g() {
[](auto) {
[](auto) {
({
struct A {};
});
};
}(1);
}
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