aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-10-09 04:39:54 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-10-09 04:39:54 +0000
commit1d1e70ec6545c8ca863e00aaca14287269a23c1c (patch)
tree7684e6b14901879222b4bd80d9acd4a3837bfa5e
parent90fb58e9f5482d2be61c4acfedf4fa69585c8ac1 (diff)
Fix g++.dg regressions introduced at r115347 (rdar://8529993)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116144 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp4
-rw-r--r--test/SemaCXX/friend.cpp9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index fa3a4047e5..8efd49580f 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3675,7 +3675,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
}
if (D.getCXXScopeSpec().isSet() && !NewFD->isInvalidDecl()) {
- if (!CurContext->isRecord()) {
+ if (isFriend || !CurContext->isRecord()) {
// Fake up an access specifier if it's supposed to be a class member.
if (!Redeclaration && isa<CXXRecordDecl>(NewFD->getDeclContext()))
NewFD->setAccess(AS_public);
@@ -3722,7 +3722,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
Diag((*Func)->getLocation(), diag::note_member_def_close_match);
}
}
- } else if (!isFriend) {
+ } else {
// The user provided a superfluous scope specifier inside a class definition:
//
// class X {
diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp
index 30abcbbeaa..e35c500e9a 100644
--- a/test/SemaCXX/friend.cpp
+++ b/test/SemaCXX/friend.cpp
@@ -62,3 +62,12 @@ namespace test4 {
class T4B {};
}
+
+namespace rdar8529993 {
+struct A { ~A(); }; // expected-note {{nearly matches}}
+
+struct B : A
+{
+ template<int> friend A::~A(); // expected-error {{does not match}}
+};
+}