MSVC compat: Allow lookup of friend types in enclosing namespaces
authorReid Kleckner <reid@kleckner.net>
Thu, 10 Jul 2014 23:44:52 +0000 (23:44 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 10 Jul 2014 23:44:52 +0000 (23:44 +0000)
commit0902a51bafc72030d52a3c8d55b7b983a23fee75
tree3167b4fb939e23851ac28acc3cd479e049b26dcd
parent3f19ada88e24008b24a5db20b7f78f5cff525a0b
MSVC compat: Allow lookup of friend types in enclosing namespaces

The relevant portion of C++ standard says [namespace.memdef]p3:

  If the name in a friend declaration is neither qualified nor a
  template-id and the declaration is a function or an
  elaborated-type-specifier, the lookup to determine whether the entity
  has been previously declared shall not consider any scopes outside the
  innermost enclosing namespace.

MSVC does not implement that rule for types.  If there is a type in an
enclosing namespace, they consider an unqualified tag declaration with
the same name to be a redeclaration of the type from another namespace.

Implementing compatibility is a simple matter of disabling our
implementation of this rule for types, which was added in r177473.

Reviewers: rsmith

Differential Revision: http://reviews.llvm.org/D4443

llvm-svn: 212784
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCXX/MicrosoftExtensions.cpp
clang/test/SemaCXX/ms-friend-lookup.cpp [new file with mode: 0644]