[LLVMbugs] [Bug 17950] New: Friend template class not found outside of namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 15 16:24:38 PST 2013


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: unassignedclangbugs at nondot.org
          Reporter: gafunchal at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131116/d92d31a3/attachment.html>


More information about the llvm-bugs mailing list