[LLVMbugs] [Bug 11888] New: Friend method unable to call protected member function.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 30 12:58:42 PST 2012


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

             Bug #: 11888
           Summary: Friend method unable to call protected member
                    function.
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: lukes.dylan at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7972
  --> http://llvm.org/bugs/attachment.cgi?id=7972
The offending example, preprocessed. The actual code is the last ~30 lines. The
rest is stdlib spew.

In some (unknown) cases, calling a protected member function from a friend
function fails. If the friend function is defined in the header file, it does
not fail with the following warning.

clang++ -std=c++11 foo.cc                                                      
                                                                         1 ↵
In file included from ast.cc:1:
ast.cc:6:8: error: 'display' is a protected member of 'wsc::ast::Node'
  node.display(o);
       ^
./ast.hh:31:20: note: declared protected here
      virtual void display(std::ostream &) const = 0;
                   ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list