[clang] [Clang] Implement C++26’s P2893R3 ‘Variadic friends’ (PR #101448)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 15 09:46:12 PDT 2024
================
@@ -17509,8 +17528,17 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
if (TheDeclarator.isInvalidType())
return nullptr;
- if (DiagnoseUnexpandedParameterPack(Loc, TSI, UPPC_FriendDeclaration))
+ // If '...' is present, the type must contain an unexpanded parameter
+ // pack, and vice versa.
+ if (EllipsisLoc.isInvalid() &&
+ DiagnoseUnexpandedParameterPack(Loc, TSI, UPPC_FriendDeclaration))
return nullptr;
+ if (EllipsisLoc.isValid() &&
+ !TSI->getType()->containsUnexpandedParameterPack()) {
+ Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
+ << TSI->getTypeLoc().getSourceRange();
+ EllipsisLoc = SourceLocation();
----------------
cor3ntin wrote:
I think this is the only outstanding nit, and then we can merge
https://github.com/llvm/llvm-project/pull/101448
More information about the cfe-commits
mailing list