[LLVMbugs] [Bug 16032] clang -fms-extensions considers an unqualified friend decl to be a forward decl in the enclosing namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 28 11:30:13 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=16032

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |FIXED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Obligatory standard quotes:

7.3.1.2/3:

"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."

So the friend declaration does not find views::Widget, and the
elaborated-type-specifier is instead the first declaration of an entity. Then
(same paragraph):

"If a friend declaration in a non-local class first declares a class [...] the
friend is a member of the innermost enclosing namespace. The friend declaration
does not by itself make the name visible to unqualified lookup (3.4.1) or
qualified lookup (3.4.3)."

So the friend declares views::internal::Widget, but does not make it visible to
name lookup.


The problem here was that under -fms-extensions, we'd make the injected friend
name visible. The actual MS behavior seems to be more subtle than that; our new
behavior is that we make the injected friend visible unless friend lookup would
find something outside the innermost enclosing namespace.

FWIW, this is still broken in a couple of ways:
  * our -fms-extensions behavior here is not a conforming extension
  * presumably with the MS compatibility hack enabled, we should befriend
views::Widget, not views::internal::Widget

Anyway, the original bug here is fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140328/edd60638/attachment.html>


More information about the llvm-bugs mailing list