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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to