diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-12-16 01:14:37 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-12-16 01:14:37 +0000 |
| commit | 6c110f385b78ab617d3e3598c55dca79905435f9 (patch) | |
| tree | ee484fbce320bdc4f589e51e4bc20bf348f79cd1 /clang/lib/Sema | |
| parent | 7cabbe04ebdd38cd62fe4563325e9dffee84f243 (diff) | |
| download | bcm5719-llvm-6c110f385b78ab617d3e3598c55dca79905435f9.tar.gz bcm5719-llvm-6c110f385b78ab617d3e3598c55dca79905435f9.zip | |
Check for unexpanded parameter packs in friend declarations.
llvm-svn: 121934
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index c3384a51628..b46561851cd 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2332,6 +2332,10 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, if (D.getCXXScopeSpec().isInvalid()) D.setInvalidType(); else if (D.getCXXScopeSpec().isSet()) { + if (DiagnoseUnexpandedParameterPack(D.getCXXScopeSpec(), + UPPC_DeclarationQualifier)) + return 0; + bool EnteringContext = !D.getDeclSpec().isFriendSpecified(); DC = computeDeclContext(D.getCXXScopeSpec(), EnteringContext); if (!DC) { diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 4a9abec5838..0cf5f99b644 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -6383,6 +6383,9 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, if (TheDeclarator.isInvalidType()) return 0; + if (DiagnoseUnexpandedParameterPack(Loc, TSI, UPPC_FriendDeclaration)) + return 0; + // This is definitely an error in C++98. It's probably meant to // be forbidden in C++0x, too, but the specification is just // poorly written. @@ -6482,6 +6485,12 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition, DeclarationName Name = NameInfo.getName(); assert(Name); + // Check for unexpanded parameter packs. + if (DiagnoseUnexpandedParameterPack(Loc, TInfo, UPPC_FriendDeclaration) || + DiagnoseUnexpandedParameterPack(NameInfo, UPPC_FriendDeclaration) || + DiagnoseUnexpandedParameterPack(SS, UPPC_FriendDeclaration)) + return 0; + // The context we found the declaration in, or in which we should // create the declaration. DeclContext *DC; |

