[PATCH] MSVC compat: Allow lookup of friend types in enclosing namespaces

Reid Kleckner rnk at google.com
Wed Jul 9 15:32:18 PDT 2014


Hi rsmith, doug.gregor,

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.

http://reviews.llvm.org/D4443

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/MicrosoftCompatibility.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4443.11226.patch
Type: text/x-patch
Size: 4010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140709/9bfed217/attachment.bin>


More information about the cfe-commits mailing list