[LLVMbugs] [Bug 15496] New: elaborated-type-specifiers in friend declarations find names beyond the innermost enclosing namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 12 10:32:33 PDT 2013


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

            Bug ID: 15496
           Summary: elaborated-type-specifiers in friend declarations find
                    names beyond the innermost enclosing namespace
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following example compiles without error in Clang:

namespace A {
struct foo {
  void func();
};
namespace B {
struct bar {
  friend class foo;
private:
  int i;
};
}
}

void A::foo::func() {
  A::B::bar b;
  b.i = 3;
}

int main() {
}

Yet 7.1.3p2 states:

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

Which, if I'm reading that correctly, means that the above example should fail
to compile (because the 'foo' declared by the friend declaration should be
A::B::foo, not A::foo)

-- 
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/20130312/f50d3fd9/attachment.html>


More information about the llvm-bugs mailing list