[PATCH] Fix c++/78621 generic lambda mangling
Nathan Sidwell
nathan@acm.org
Wed Dec 7 18:31:00 GMT 2016
This patch fixes the generic lambda mangling bug that caused the
demangler to infinitely recurse (78252). The generic's auto parms fail
the is_auto check because that's testing for the 'auto' identifier,
whereas the parms are distinct template type parms named 'auto:$N'.
Amending is_auto to do a textual compare of the identifier breaks
things, and is insufficient anyway. The mangler's squangling must (a)
squangle subsequent auto uses as expected and (b) NOT squangle
subsequent template type parm references to refer the the lambda's autos.
This patch achieves that by tsubsting the generic fn's parameters using
a consed up array of regular auto types. The make_auto_1 function is
further split, so we can control the template LEVEL and ORIG_LEVEL
values. When mangling a lambda, we check if it's a generic lambda and
then (after checking the ABI flag) perform this substitution. We also
set the needs_warning flag, if we detect the user's asked about ABI
compatibility crossing version 11.
This use of tsubst can meet {TYPE,EXPR}_PARAMETER_PACKs, so I had to
extend tsubst to process those objects.
lambda-mangle-1 is an augmented version of the testcase I included with
78252. It checks we retain the old mangling for ABI 10 and below.
lambda-mangle-2 is essentially the same testcase, but checks we use the
new mangling for ABI=0
lambda-mangle-3 checks we issue a warning for -Wabi=10
I also included a demangler test for the new mangling. It does demangle
as expected.
Documentation about -fabi-version=11 also updated.
ok?
nathan
--
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto-mangle.patch
Type: text/x-patch
Size: 12562 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161207/00d221c8/attachment.bin>
More information about the Gcc-patches
mailing list