diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-05-07 22:38:01 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-05-07 22:38:01 +0200 |
commit | 17458d2bc74b904968e6bdc12527eb040c8d2370 (patch) | |
tree | 8b04d926081608e70d1255dd7b4e7f803ad19ee4 /gcc/c-family | |
parent | 28ee13db2e9d995bd3728c4ff3a3545e24b39cd2 (diff) | |
download | gcc-upstream-17458d2bc74b904968e6bdc12527eb040c8d2370.tar.gz |
c++: Implement C++26 P2893R3 - Variadic friends [PR114459]
The following patch imeplements the C++26 P2893R3 - Variadic friends
paper. The paper allows for the friend type declarations to specify
more than one friend type specifier and allows to specify ... at
the end of each. The patch doesn't introduce tentative parsing of
friend-type-declaration non-terminal, but rather just extends existing
parsing where it is a friend declaration which ends with ; after the
declaration specifiers to the cases where it ends with ...; or , or ...,
In that case it pedwarns for cxx_dialect < cxx26, handles the ... and
if there is , continues in a loop to parse the further friend type
specifiers.
2024-05-07 Jakub Jelinek <jakub@redhat.com>
PR c++/114459
gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Predefine
__cpp_variadic_friend=202403L for C++26.
gcc/cp/
* parser.cc (cp_parser_member_declaration): Implement C++26
P2893R3 - Variadic friends. Parse friend type declarations
with ... or with more than one friend type specifier.
* friend.cc (make_friend_class): Allow TYPE_PACK_EXPANSION.
* pt.cc (instantiate_class_template): Handle PACK_EXPANSION_P
in friend classes.
gcc/testsuite/
* g++.dg/cpp26/feat-cxx26.C (__cpp_variadic_friend): Add test.
* g++.dg/cpp26/variadic-friend1.C: New test.
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/c-cppbuiltin.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc index b6f25e4db3c..d9b84a0f1b9 100644 --- a/gcc/c-family/c-cppbuiltin.cc +++ b/gcc/c-family/c-cppbuiltin.cc @@ -1093,6 +1093,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_placeholder_variables=202306L"); cpp_define (pfile, "__cpp_structured_bindings=202403L"); cpp_define (pfile, "__cpp_deleted_function=202403L"); + cpp_define (pfile, "__cpp_variadic_friend=202403L"); } if (flag_concepts) { |