diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index ed609fe1011b..7e188c26f9c2 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -443,7 +443,8 @@ public: 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. diff --git a/clang/test/SemaTemplate/friend.cpp b/clang/test/SemaTemplate/friend.cpp new file mode 100644 index 000000000000..cd74cb1b365b --- /dev/null +++ b/clang/test/SemaTemplate/friend.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -fsyntax-only -verify %s +template struct A { + struct B { }; + + friend struct B; +}; + +void f() { + A::B b; +}