Commit a3f54a9
c++: lambda in function template signature [PR119401]
Here we instantiate the lambda three times in producing A<0>::f:
1) in tsubst_function_type, substituting the type of A<>::f
2) in tsubst_function_decl, substituting the parameters of A<>::f
3) in regenerate_decl_from_template when instantiating A<>::f
The first one gets thrown away by maybe_rebuild_function_decl_type. Before
r15-7202, we happily built all of them and mangled the result wrongly as
lambda gcc-mirror#3. After r15-7202, we try to mangle gcc-mirror#3 as gcc-mirror#1, which breaks because
gcc-mirror#1 is already mangled as gcc-mirror#1.
This patch avoids building gcc-mirror#3 by suppressing regenerate_decl_from_template
if the template signature includes a lambda, fixing the ICE.
We now mangle the lambda as gcc-mirror#2, which is still wrong. Addressing that
should involve not calling tsubst_function_type from tsubst_function_decl,
and building the type from the parms types in the first place rather than
fixing it up in maybe_rebuild_function_decl_type.
PR c++/119401
gcc/cp/ChangeLog:
* pt.cc (regenerate_decl_from_template): Don't regenerate if the
signature involves a lambda.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/lambda-targ11.C: New test.1 parent ac948a4 commit a3f54a9
File tree
3 files changed
+39
-0
lines changed- gcc
- cp
- testsuite/g++.dg/cpp2a
3 files changed
+39
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27238 | 27238 | | |
27239 | 27239 | | |
27240 | 27240 | | |
| 27241 | + | |
| 27242 | + | |
| 27243 | + | |
| 27244 | + | |
| 27245 | + | |
| 27246 | + | |
| 27247 | + | |
| 27248 | + | |
| 27249 | + | |
| 27250 | + | |
| 27251 | + | |
| 27252 | + | |
| 27253 | + | |
27241 | 27254 | | |
27242 | 27255 | | |
27243 | 27256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments