aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/invoke.texi
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-12-16 16:06:05 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2025-01-23 17:38:07 +1100
commit685c458fb4775cbd1a3b3d3585d1e5615d7eaee9 (patch)
tree8e3f153e1f302a197d028219eef7115065e13e2d /gcc/doc/invoke.texi
parent21cccfa91e6ed172062e0c62682422269c914937 (diff)
downloadgcc-685c458fb4775cbd1a3b3d3585d1e5615d7eaee9.zip
gcc-685c458fb4775cbd1a3b3d3585d1e5615d7eaee9.tar.gz
gcc-685c458fb4775cbd1a3b3d3585d1e5615d7eaee9.tar.bz2
c++: Fix mangling of lambdas in static data member initializers [PR107741]
This fixes an issue where lambdas declared in the initializer of a static data member within the class body do not get a mangling scope of that variable; this results in mangled names that do not conform to the ABI spec. To do this, the patch splits up grokfield for this case specifically, allowing a declaration to be build and used in start_lambda_scope before parsing the initializer, so that record_lambda_scope works correctly. As a drive-by, this also fixes the issue of a static member not being visible within its own initializer. PR c++/107741 gcc/c-family/ChangeLog: * c-opts.cc (c_common_post_options): Bump ABI version. gcc/ChangeLog: * common.opt: Add -fabi-version=20. * doc/invoke.texi: Likewise. gcc/cp/ChangeLog: * cp-tree.h (start_initialized_static_member): Declare. (finish_initialized_static_member): Declare. * decl2.cc (start_initialized_static_member): New function. (finish_initialized_static_member): New function. * lambda.cc (record_lambda_scope): Support falling back to old ABI (maybe with warning). * parser.cc (cp_parser_member_declaration): Build decl early when parsing an initialized static data member. gcc/testsuite/ChangeLog: * g++.dg/abi/macro0.C: Bump ABI version. * g++.dg/abi/mangle74.C: Remove XFAILs. * g++.dg/other/fold1.C: Restore originally raised error. * g++.dg/abi/lambda-ctx2-19.C: New test. * g++.dg/abi/lambda-ctx2-19vs20.C: New test. * g++.dg/abi/lambda-ctx2-20.C: New test. * g++.dg/abi/lambda-ctx2.h: New test. * g++.dg/cpp0x/static-member-init-1.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r--gcc/doc/invoke.texi3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 75fbe88..2f5d60b 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3020,6 +3020,9 @@ that have additional context.
Version 19, which first appeard in G++ 14, fixes manglings of structured
bindings to include ABI tags.
+Version 20, which first appeared in G++ 15, fixes manglings of lambdas
+in static data member initializers.
+
See also @option{-Wabi}.
@opindex fabi-compat-version