diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-01-09 07:36:13 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-01-09 07:36:13 +0000 |
commit | a2f75da3f0d6d316bd8a494045044b10fc982bc2 (patch) | |
tree | 83dfde1d617e26443875a467c9d5678a1032c760 /lib/Sema | |
parent | ea6cc726d11365a23ac85d1c3d5884809895843e (diff) |
Sema: RecordDecl shouldn't have a FunctionDecl as a Decl
RecordDecls should have things like CXXMethodDecls or FriendDecls as a
decl but not things like FunctionDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 1e20121b37..970b2ecd72 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6712,6 +6712,11 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, IsVirtualOkay = !Ret->isStatic(); return Ret; } else { + bool isFriend = + SemaRef.getLangOpts().CPlusPlus && D.getDeclSpec().isFriendSpecified(); + if (!isFriend && SemaRef.CurContext->isRecord()) + return nullptr; + // Determine whether the function was written with a // prototype. This true when: // - we're in C++ (where every function has a prototype), @@ -7482,7 +7487,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } else if (isFunctionTemplateSpecialization) { if (CurContext->isDependentContext() && CurContext->isRecord() && !isFriend) { - isDependentClassScopeExplicitSpecialization = isa<CXXMethodDecl>(NewFD); + isDependentClassScopeExplicitSpecialization = true; Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) |