summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-09 07:36:13 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-09 07:36:13 +0000
commitaa30dd74976f79720de873557ccb84334f5675ac (patch)
tree5612d4db9d9d622ea2d825ab43706cd93f22836c /clang/lib/Sema/SemaDecl.cpp
parentb68fa3b57619affe3eb31eabeaf6297fd93a7882 (diff)
downloadbcm5719-llvm-aa30dd74976f79720de873557ccb84334f5675ac.tar.gz
bcm5719-llvm-aa30dd74976f79720de873557ccb84334f5675ac.zip
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. llvm-svn: 225511
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1e20121b375..970b2ecd72c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud