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

            Bug ID: 17950
           Summary: Friend template class not found outside of namespace
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

template<typename T>
class Class1;

namespace B {
  template<typename U>
  class Class2 {
    template<typename V>
    friend class Class1;
  private:
    int something_private;
  };
}

template<typename T>
class Class1
{
  void error() {
    B::Class2 b;
    b.something_private = 42;
  }
};

Incorrectly issues an error because it things something_private is a private
member of B::Class2 (friend statement lookup didn't work). g++ correctly
doesn't flag an error.

Replacing the friend declaration by:

    template<typename V>
    friend class ::Class1;

Seems to fix the problem, confirming it looks like a name lookup problem.

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