GCC modified for the FreeChainXenon project
![]() The original PR114393 testcase is unfortunately still not accepted after r14-9938-g081c1e93d56d35 due to return type deduction confusion when a lambda-expr is used as a default template argument. The below reduced testcase demonstrates the bug. Here when forming the dependent specialization b_v<U> we substitute the default argument of F, a lambda-expr, with _Descriptor=U. (In this case in_template_context is true since we're in the context of the template c_v, so we don't defer.) This substitution in turn lowers the level of the lambda's auto return type from 2 to 1 and so later, when instantiating c_v<int, char> we wrongly substitute this auto with the template argument at level=0,index=0, i.e. int, instead of going through do_auto_deduction which would yield char. One way to fix this would be to use a level-less auto to represent a deduced return type of a lambda, but that might be too invasive of a change at this stage, and it might be better to do this across the board for all deduced return types. Another way would be to pass tf_partial from coerce_template_parms during dependent substitution into a default template argument so that the substitution doesn't do any level-lowering, but that wouldn't do the right thing in this case due to the tf_partial early exit in the LAMBDA_EXPR case of tsubst_expr. Yet another way, and the approach that this patch takes, is to just defer all dependent substitution into a lambda-expr, building upon the logic added in r14-9938-g081c1e93d56d35. This also helps ensure LAMBDA_EXPR_REGEN_INFO consists only of the concrete template arguments that were ultimately substituted into the most general lambda. PR c++/114393 gcc/cp/ChangeLog: * pt.cc (tsubst_lambda_expr): Also defer all dependent substitution. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-targ2a.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.