https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110961
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:811cc466193d7efcfcc07d2081b1284d97fc91a1 commit r17-1455-g811cc466193d7efcfcc07d2081b1284d97fc91a1 Author: Marek Polacek <[email protected]> Date: Tue May 19 19:03:33 2026 -0400 c++: recognize more aliases with lambda targs [PR125212] This patch introduces a new TYPE_DECL flag so that dependent_opaque_alias_p doesn't have to peruse the tree every time it's called to see if there is a LAMBDA_EXPR, in which case the alias should be opaque. Using walk_tree in dependent_opaque_alias_p was too expensive, and the special cases we had there were fooled by more deeply nested lambdas. Compiling range-v3's zip.cpp, perf stat shows: this patch: 28.826446158 seconds time elapsed trunk: 29.425441889 seconds time elapsed so this patch makes the situation marginally better. PR c++/121287 PR c++/125212 PR c++/105667 PR c++/121597 PR c++/110961 gcc/cp/ChangeLog: * cp-tree.h (TYPE_DECL_OPAQUE_ALIAS_P): Define. (any_lambdas_p): Declare. * decl.cc (grokdeclarator): Set TYPE_DECL_OPAQUE_ALIAS_P. * pt.cc (dependent_opaque_alias_p): Refine to check TYPE_DECL_OPAQUE_ALIAS_P. (tsubst_decl) <case TYPE_DECL>: Set TYPE_DECL_OPAQUE_ALIAS_P. (any_lambdas_p): New, factored out of... (regenerate_decl_from_template): ...this. Call it. gcc/testsuite/ChangeLog: * g++.dg/cpp26/lambda-targ1.C: New test. * g++.dg/cpp2a/lambda-targ26.C: New test. * g++.dg/cpp2a/lambda-targ27.C: New test. * g++.dg/cpp2a/lambda-targ28.C: New test. * g++.dg/cpp2a/lambda-targ29.C: New test. * g++.dg/cpp2a/lambda-targ30.C: New test. * g++.dg/cpp2a/lambda-targ31.C: New test. * g++.dg/cpp2a/lambda-targ32.C: New test. Reviewed-by: Jason Merrill <[email protected]>
