Summary: | [13 Regression] ICE in start_preparsed_function with static on generic lambdas inside a template | ||
---|---|---|---|
Product: | gcc | Reporter: | G. Steinmetz <gscfq> |
Component: | c++ | Assignee: | Jason Merrill <jason> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jakub, jason |
Priority: | P1 | Keywords: | c++-lambda, ice-on-valid-code |
Version: | 13.0 | ||
Target Milestone: | 13.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2023-01-24 00:00:00 |
Description
G. Steinmetz
2023-01-24 17:50:03 UTC
This is valid code in C++23. Most likely the ICE started when static operator() support (for C++23) came in via r13-2892-g303976a6076f28 . Indeed, also started with r13-2892-g303976a6076f283935470 The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:39ade88fa1632c659c5c4ed065fa2b62d16a8670 commit r13-5334-g39ade88fa1632c659c5c4ed065fa2b62d16a8670 Author: Jason Merrill <jason@redhat.com> Date: Tue Jan 24 15:29:35 2023 -0500 c++: static lambda in template [PR108526] tsubst_lambda_expr uses build_memfn_type to build a METHOD_TYPE for the new lamba op(). This is not what we want for a C++23 static op(), but since we also use that METHOD_TYPE to communicate the closure type down to tsubst_function_decl, let's wait and turn it back at that point. PR c++/108526 gcc/cp/ChangeLog: * pt.cc (tsubst_function_decl): Handle static lambda. gcc/testsuite/ChangeLog: * g++.dg/cpp23/static-operator-call5.C: New test. Fixed. The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:4f181f9c7ee3efc509d185fdfda33be9018f1611 commit r13-6533-g4f181f9c7ee3efc509d185fdfda33be9018f1611 Author: Jason Merrill <jason@redhat.com> Date: Mon Mar 6 21:36:28 2023 -0500 c++: static lambda tsubst [PR108526] A missed piece of the patch for static operator(): in tsubst_function_decl, we don't want to replace the first parameter with a new closure pointer if operator() is static. PR c++/108526 PR c++/106651 gcc/cp/ChangeLog: * pt.cc (tsubst_function_decl): Don't replace the closure parameter if DECL_STATIC_FUNCTION_P. gcc/testsuite/ChangeLog: * g++.dg/cpp23/static-operator-call5.C: Pass -g. |