[cfe-commits] r81730 - in /cfe/trunk: include/clang/AST/DeclBase.h test/SemaTemplate/friend.cpp

Anders Carlsson andersca at mac.com
Sun Sep 13 16:59:13 PDT 2009


Author: andersca
Date: Sun Sep 13 18:59:13 2009
New Revision: 81730

URL: http://llvm.org/viewvc/llvm-project?rev=81730&view=rev
Log:
Fix a bug in getFriendObjectKind where we would clear out all mask bits except IDNS_TagFriend and IDNS_OrdinaryFriend but then check for IDNS_Tag and IDNS_Ordinary.

Added:
    cfe/trunk/test/SemaTemplate/friend.cpp
Modified:
    cfe/trunk/include/clang/AST/DeclBase.h

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=81730&r1=81729&r2=81730&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sun Sep 13 18:59:13 2009
@@ -443,7 +443,8 @@
     unsigned mask
       = (IdentifierNamespace & (IDNS_TagFriend | IDNS_OrdinaryFriend));
     if (!mask) return FOK_None;
-    return (mask & (IDNS_Tag | IDNS_Ordinary) ? FOK_Declared : FOK_Undeclared);
+    return (IdentifierNamespace & (IDNS_Tag | IDNS_Ordinary) ? 
+              FOK_Declared : FOK_Undeclared);
   }
 
   // Implement isa/cast/dyncast/etc.

Added: cfe/trunk/test/SemaTemplate/friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/friend.cpp?rev=81730&view=auto

==============================================================================
--- cfe/trunk/test/SemaTemplate/friend.cpp (added)
+++ cfe/trunk/test/SemaTemplate/friend.cpp Sun Sep 13 18:59:13 2009
@@ -0,0 +1,10 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename T> struct A {
+  struct B { };
+  
+  friend struct B;
+};
+
+void f() {
+  A<int>::B b;
+}





More information about the cfe-commits mailing list