]> granicus.if.org Git - clang/commitdiff
Fix g++.dg regressions introduced at r115347 (rdar://8529993)
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 9 Oct 2010 04:39:54 +0000 (04:39 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 9 Oct 2010 04:39:54 +0000 (04:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116144 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/friend.cpp

index fa3a4047e59afe501cdba103ef8c7b2f457cb70f..8efd49580f0701f25371f3ae356b57cb4eb07dad 100644 (file)
@@ -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 {
index 30abcbbeaa528b1a2be61f5eaad76626d9582a46..e35c500e9a70844360f076fa7e3f009eab1228c0 100644 (file)
@@ -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}}
+};
+}